Created
January 7, 2019 21:41
-
-
Save mitchhentges/6b8caf2f495bf2956052c129b2f40c90 to your computer and use it in GitHub Desktop.
Improving maintenance by reducing the degree of inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Passing dictionaries | |
def deep_function(context): | |
expected = context['expected'] | |
actual = context['actual'] | |
return expected == actual | |
def main(): | |
context = { | |
'expected': 42, | |
'actual': 40, | |
} | |
deep_function(context) | |
###### | |
# Passing direct parameters | |
def deep_function(expected, actual): | |
return expected == actual | |
def main(): | |
deep_function(42, 40) | |
# or, if you don't want to rely on your IDE | |
deep_function(expected=42, actual=40) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment