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.
-- http://mail.python.org/mailman/listinfo/python-list