Skip to content

Instantly share code, notes, and snippets.

@jacoby
Created February 11, 2013 16:17
Show Gist options
  • Save jacoby/4755471 to your computer and use it in GitHub Desktop.
Save jacoby/4755471 to your computer and use it in GitHub Desktop.
This is how you send a function zero or one arguments in Python
def yaml_test( *args ):
config = '~/twitter.cnf'
assert 0 <= len(args) < 2
if len(args)==1:
config = args[0]
do_yaml( config )
@unixmonkey
Copy link

def yaml_test( config='~/twitter.cnf' ):
    do_yaml( config )

@jacoby
Copy link
Author

jacoby commented Feb 11, 2013

That is even better! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment