Skip to content

Instantly share code, notes, and snippets.

@jacoby
Created February 11, 2013 16:17
Show Gist options
  • Select an option

  • Save jacoby/4755471 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
def yaml_test( config='~/twitter.cnf' ):
    do_yaml( config )

@jacoby

jacoby commented Feb 11, 2013

Copy link
Copy Markdown
Author

That is even better! Thanks!

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