Michael Bayer wrote:
> also, I challenge your assertion that saying "x and y or z" is a
> perlish thing (its a C and Java thing if anything); python 2.5 has just
> added the "y if x else z" syntax which is essentially an official
> version of the same thing.
> 

Well, I wasn't really talking about 'x and y or z'. I was actually referring to 
your HUGE incomprehensible one-liner...it wrapped to three lines in my editor.

However, the 'x and y or z' idiom is also discouraged because it is NOT the 
same thing as 'y if x else z'. If it was the same thing then they wouldn't have 
added that new syntax (which is really ugly IMO, but I digress) to 2.5. The 
reason they needed a new syntax is because the 'x and y or z' idiom fails if y 
evaluates to false. Example:

x = True
y = ''
z = 'else'

v = x and y or z

assert v == y # ERROR!



~ Daniel

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to