an ingrate newbie complains
Elaine Jackson
elainejackson7355 at home.com
Wed Feb 4 12:18:55 EST 2004
I have some minor complaints about the Python language, and I'm interested to
know how other people feel about them. Here they are:
1) I find the following behavior puzzling and disappointing:
>>> X=[(1,1),(2,4),(3,9),(4,16),(5,25)]
>>> Y=dict(X)
>>> Z=list(Y)
>>> Z==X
False
>>> Z==Y.keys()
True
2) How come you can't write...
if y = f(x) > 3:
<do a bunch of things with x and y>
...as an equivalent of...
y = f(x)
if y > 3:
<do a bunch of things with x and y>
...?
That kind of syntax would be especially welcome in list comprehensions:
[f(x,y) for x in list if y=g(x)<=0]
If g(x) is a fairly complicated expression, and y occurs several times in
f(x,y), considerable clarity could be gained.
More information about the Python-list
mailing list