Message63499
| Author | mark |
|---|---|
| Recipients | mark |
| Date | 2008-03-13.08:14:44 |
| SpamBayes Score | 0.055408463 |
| Marked as misclassified | No |
| Message-id | <1205396087.42.0.232121283205.issue2283@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-03-13 08:14:48 | mark | set | spambayes_score: 0.0554085 -> 0.055408463 recipients: + mark |
| 2008-03-13 08:14:47 | mark | set | spambayes_score: 0.0554085 -> 0.0554085 messageid: <1205396087.42.0.232121283205.issue2283@psf.upfronthosting.co.za> |
| 2008-03-13 08:14:46 | mark | link | issue2283 messages |
| 2008-03-13 08:14:45 | mark | create | |