Proposal: function which simulates C ?: operator
Erik Max Francis
max at alcyone.com
Sun Jul 11 16:35:31 EDT 2004
Adal Chiriliuc wrote:
> I think a function similar to the one below should be added to the
> builtin module:
>
> def boolselect(condition, trueresult, falseresult):
> if condition:
> return trueresult
> else:
> return falseresult
This doesn't simulate the conditional operator; it doesn't do
short-circuiting. See PEP 308; this kind of construct was explicitly
rejected (but then, so is the whole PEP).
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ Forever we / Infinitely
-- Sandra St. Victor
More information about the Python-list
mailing list