[Fwd: Re: [triangle-zpug] Python 2.5]

Chris Calloway cbc at unc.edu
Wed Sep 20 18:07:43 CEST 2006

Jim Allman wrote:
> Braces are recommended for additional clarity:
>     x = (true_value if condition else false_value)

Parenthesis. Never braces. :)

>>> from __future__ import braces
   File "<stdin>", line 1
SyntaxError: not a chance

> It's kinda funky, but I already like it better than the and...or  trick 
> that's current practice in Python (sorry Chris;-)

Dude, the conditional is fine with me. :) The and/or trick was just a
hack. And an ugly one at that when having to use [0] with it. No need to
be sorry on my account. Guido just made the language a little more
elegant with the addition of conditionals.

I think Guido chose a very good syntax as well. I like it a LOT better
than the and/or hack.

Of course, we still have to teach the and/or hack so people can
understand old code, and also to make them think pythonically, and also
as a way to drive home how the boolean keywords "return" an object.


Chris Calloway
office: 17-6 Venable Hall   phone: (919) 962-4323
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599

More information about the triangle-zpug mailing list