PEP 276 -- What else could iter(5) mean?

James_Althoff at i2.com James_Althoff at i2.com
Wed Mar 6 14:29:49 EST 2002


[huaiyu]
> "spam".append("eggs")
> x, y, z = "d"
> x, y, z = 3
> [f(x) for x in (4 in 3) in (2 in 3) if x in (x+1 in x*2)] # just for fun.
:-)

Fun?  Ok, if you say so.

But just to make sure I understand your point, I guess you are saying the
above is bad because today's equivalent is more clear?

[f(x) for x in range((4 in range(3))) in range((2 in range(3))) if x in
range((x+1 in range(x*2)))]

Would you -- or any members of your immediate family -- really try to put
anything like this in production code? <wink>

Can you suggest a less contrived example that might be a problem?

Jim





More information about the Python-list mailing list