[issue2283] lambda *a, **k: a, k # does not work
Mark Summerfield
report at bugs.python.org
Thu Mar 13 09:14:47 CET 2008
New submission from Mark Summerfield <mark at qtrac.eu>:
According to the docs lambda can handle the same parameter list as can
def. But this does not appear to be the case as the following (both
2.5.1 and 30a3) shows:
>>> def f(*a, **kw): return a, kw
>>> f(1,2,a=3,b=4)
((1, 2), {'a': 3, 'b': 4})
>>> A = lambda *a: a
>>> A(1,2)
(1, 2)
>>> K = lambda **k: k
>>> K(a=1,b=2)
{'a': 1, 'b': 2}
>>> X = lambda *a, **k: a, k
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
X = lambda *a, **k: a, k
NameError: name 'k' is not defined
So either this is an interpreter bug, or a doc bug.
----------
components: Interpreter Core
messages: 63499
nosy: mark
severity: normal
status: open
title: lambda *a, **k: a, k # does not work
versions: Python 2.5, Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2283>
__________________________________
More information about the Python-bugs-list
mailing list