PEP 308: A PEP Writer's Experience
Aahz
aahz at pythoncraft.com
Sat Feb 8 12:10:36 EST 2003
More information about the Python-list mailing list
Sat Feb 8 12:10:36 EST 2003
- Previous message (by thread): PEP 308: A PEP Writer's Experience - PRO
- Next message (by thread): PEP 308: A PEP Writer's Experience - PRO
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <mailman.1044720530.25177.python-list at python.org>, Michael Chermside <mcherm at mcherm.com> wrote: > >If a ternary expression is available, then things can be done in >expressions which would be impossible without it. lambda is the >example most often given, but I think a different example is >more compelling. Suppose you want to write a line of logging >into your program: > > print "x = " + x.getDisplayString() > >but you have to allow for the fact that x might be None. With >a ternary expression, you can write this: > > print "x = " + x.getDisplayString() if x else "None" Why not print 'x =', x.getDisplayString() or print 'x = ' + str(x.getDisplayString()) The point is that many of the supposed uses for ternary do have simple, effective workarounds. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ Register for PyCon now! http://www.python.org/pycon/reg.html
- Previous message (by thread): PEP 308: A PEP Writer's Experience - PRO
- Next message (by thread): PEP 308: A PEP Writer's Experience - PRO
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list