Skip to content

Instantly share code, notes, and snippets.

@mitchhentges
Created January 7, 2019 21:41
Show Gist options
  • Save mitchhentges/6b8caf2f495bf2956052c129b2f40c90 to your computer and use it in GitHub Desktop.
Save mitchhentges/6b8caf2f495bf2956052c129b2f40c90 to your computer and use it in GitHub Desktop.
Improving maintenance by reducing the degree of inputs
# 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