[Python-Dev] conditional expressions?

Michael Abbott michael at rcp.co.uk
Tue Oct 16 11:36:24 CEST 2001

"Anders J. Munch" <andersjm at dancontrol.dk> wrote in 
news:3bcbfda6$0$42081$edfadb0f at dspool01.news.tele.dk:

> Quick, what does this snippet do if return_as_map is true?
>  return if return_as_map then {'A':a,'B':b} else a,b
> Rather than open up a new venue of obfuscation possibilities in
> Python, I'd go for mandatory parentheses around the conditional
> expression.

Nah.  Go for "maximal munch", I can't think of anything wrong with that.  
The above expression then returns the dictionary (only).

More information about the Python-list mailing list