On 2008-10-10 13:21, "Paul Makepeace" <[EMAIL PROTECTED]> wrote:

> Back to programming languages(!)
> 
> Just as a different perspective, here is Python growing a ternary operator,
> i.e. how to get the same behavior as the C-like C ? A : B. There was
> considerable debate about this, with Guido eventually Making a Decision.
> What's interesting is that python gets ?: without any additional keywords,
> or... punctuation: http://www.python.org/dev/peps/pep-0308/
> 
> There's no moral judgment here, just thought it was an interesting aside
> from lies & nazism.
> 
> P

Much cleaner than the old and-or trick.

for the non-pythoners:

(condition and [iftrue] or [iffalse])[0]

Explanation (quickly googled) here:
http://diveintopython.org/power_of_introspection/and_or.html

Did you catch Guido's reasoning for not adding true lambdas a while back?
They're about the only thing the python community really wanted out of
python3k and there are some very disappointed python lovers out there...

--James


Reply via email to