For review: PEP 308 - If-then-else expression

Erik Max Francis max at alcyone.com
Sun Feb 9 03:09:52 EST 2003


Evan wrote:

> t = {if "spam" not in s: "customer", "eggs" in s: "vikings",
> "waitress"}

The use of curly braces screams "dictionary" when there is not a
dictionary in sight, and the use of the comma looks like tuples are
involved when they are not.

The list comprehension syntax uses brackets, but at least that's
appropriate:  The result is a list.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Grab a club and join the chorus / Evolution is a state of mind
\__/ Oleta Adams
    Fauxident / http://www.alcyone.com/pyos/fauxident/
 A "faux" ident daemon in Python.




More information about the Python-list mailing list