A critic of Guido's blog on Python's lambda
Paul Rubin
http
Sun May 7 15:05:52 EDT 2006
aleaxit at yahoo.com (Alex Martelli) writes:
> I do hate it that
> [ x for x in container if predicate(x) ]
> is an exact synonym of the more legible
> list( x for x in container if predicate(x) )
Heh, I hate it that it's NOT an exact synonym (the listcomp leaves 'x'
polluting the namespace and clobbers any pre-existing 'x', but the
gencomp makes a new temporary scope).
> and the proposed
> {1, 2, 3}
> is an exact synonym of
> set((1, 2, 3))
There's one advantage that I can think of for the existing (and
proposed) list/dict/set literals, which is that they are literals and
can be treated as such by the parser. Remember a while back that we
had a discussion of reading expressions like
{'foo': (1,2,3),
'bar': 'file.txt'}
from configuration files without using (unsafe) eval. Aside from that
I like the idea of using constructor functions instead of special syntax.
More information about the Python-list
mailing list