Okay, my conclusion is def f((a)=5) is wrong, and the code should be changed to report a better error message. I'll file a bug against that. and I'm going with Brett suggestion that [x for x in 1,] is not supported because it's almost certainly a programming error. I think therefore the comment in the Grammar file is distracting. As comments can be. On Feb 20, 2008 3:08 AM, Steve Holden <steve at holdenweb.com> wrote: > The one that surprised me was the legality of > > def eggs((a, )=c): > pass > > That just seems like unpacking-abuse to me. Yep. Here's another abuse, since I can't figure when someone needs a destructuring del statement. >>> class X(object): pass ... >>> X.a = 123 >>> X.b = "hello" >>> X.c = 9.801 >>> X.a, X.b, X.c (123, 'hello', 9.8010000000000002) >>> del (X.a, (X.b, (X.c,))) >>> X.a, X.b, X.c Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: type object 'X' has no attribute 'a' >>> Is this going to be possible in Python3k? > You really *have* been poking around in little-known crevices, haven't you? Like this bug from 2.5, fixed in 2.6 >>> from __future__ import with_statement >>> with f(x=5, 6): ... pass ... ValueError: field context_expr is required for With :) Andrew dalke at dalkescientific.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4