generator expressions and new ternary operator
Gerrit
gerrit at nl.linux.org
Mon Sep 13 03:02:43 EDT 2004
zipher wrote:
> It seems the debate over PEP 308 (if-then-else expression) occurred
> prior to the arrival of generator expressions.
>
> Mightn't this new latter syntax be the ticket to a "one obvious way"
> to write a ternary expression in python?
>
> >>> (foo(i) if i==42 else bar(i)) # i==42 ? foo(i) : bar(i)
No. This has been suggested, and been rejected. And since generator
expressions have nothing to do with ternary expressions, it is not a
reason to re-do the discussion. There are literally thousands of
messages in the archives, including sub-threads discussing exactly this
syntax. By the time you've (re-)read them all, we'll be way beyond
Python 3.0 ;-)
yours,
Gerrit.
--
Weather in Twenthe, Netherlands 13/09 08:25:
14.0°C Broken clouds mostly cloudy wind 4.5 m/s S (57 m above NAP)
--
Gerrit Holl - 2nd year student of Applied Physics, Twente University, NL.
Experiences with Asperger's Syndrome:
EN http://topjaklont.student.utwente.nl/english/
NL http://topjaklont.student.utwente.nl/
More information about the Python-list
mailing list