Last active
December 10, 2015 20:58
-
-
Save micolous/4491315 to your computer and use it in GitHub Desktop.
null kwargs strangeness
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
#!/usr/bin/env python | |
def some_operation(foo=0): | |
print ("foo is %r" % foo) | |
def kwargs_print(**kwargs): | |
print ("you gave me %r" % kwargs) | |
a = {} | |
kwargs_print(**a) | |
some_operation(**a) | |
a = {'foo': 1} | |
kwargs_print(**a) | |
some_operation(**a) | |
a = {'foo\0bar': 2} | |
kwargs_print(**a) | |
some_operation(**a) | |
# on py2.7.2, throws: | |
# TypeError: some_operation() got an unexpected keyword argument 'foo' | |
# on py3.3.0, throws: | |
# TypeError: some_operation() got an unexpected keyword argument 'foo bar' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment