SystemError when defining
Joshua Landau
joshua.landau.ws at gmail.com
Thu Nov 3 18:24:09 EDT 2011
Try this out (Python 3.2.2 (default, Sep 5 2011, 04:52:19)):
global_variable = None
> (lambda *, keyword_only=global_variable: None) # Works, as
> expected
> (lambda: (lambda argument=global_variable: None))() # Works, as
> expected
> (lambda: (lambda *, keyword_only=global_variable: None))() # Fails???
> (lambda: (lambda argument=fake_variable: None))() # Fails, as
> expected
> (lambda: (lambda *, keyword_only=fake_variable: None))() # Fails???
Non-lambdas work as expected, but a lambda inside a non-lambda still
exhibits this behaviour.
Conclusion:
When setting defaults to keyword-only arguments in lambdas which are inside
non-global scopes, cPython is unable to access the global scope and raises
SystemError.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111103/d5b8e272/attachment.html>
More information about the Python-list
mailing list