For review: PEP 308 - If-then-else expression
eppstein at ics.uci.edu
Sun Feb 9 00:24:32 CET 2003
In article <f9068f8e.0302081508.8615a97 at posting.google.com>,
janto_d at hotmail.com (Janto Dreijer) wrote:
> I find it difficult to imagine a situation where the short-circuit
> behavior actually matters. Theoretically an ifelse function doesn't do
> the same thing, but practically it does: Whenever I've used ternary
> ops there weren't any side effects to evaluating both arguments.
> Neither any performance ones.
> Can someone give me a real world example of its usefulness?
There have already been a couple of examples posted in this thread,
where one side contains an array reference that could give an array out
of bounds if the condition is not met.
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list