Skip to content

Instantly share code, notes, and snippets.

@zackmdavis
Last active August 29, 2015 14:21
Show Gist options
  • Save zackmdavis/1eceb0b8ec21c11de1ae to your computer and use it in GitHub Desktop.
Save zackmdavis/1eceb0b8ec21c11de1ae to your computer and use it in GitHub Desktop.
pzmd@SuddenHeap:~/Code/swift$ python3
Python 3.4.1 (default, May 25 2014, 22:33:14)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def my_function(first, second, opt1=1, opt2=2, opt3=3):
... ... # do stuff
...
>>> my_function("first_value", opt1="a", opt2="b", opt3="c")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: my_function() missing 1 required positional argument: 'second'
>>>
zmd@SuddenHeap:~/Code/swift$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def my_function(first, second, opt1=1, opt2=2, opt3=3):
... pass # do stuff
...
>>> my_function("first_value", opt1="a", opt2="b", opt3="c")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: my_function() takes at least 2 arguments (4 given)
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment