Re: [Info] PEP 308 accepted - new conditional expressions
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: [Info] PEP 308 accepted - new conditional expressions

From: Richie Hindle <rjh@cyberscience.com>
Date: Fri Sep 30 2005 - 16:19:02 CEST

[Fredrik]
> > X if C else Y
>
> hopefully, only one of Y or X is actually evaluated ?

Yes. From Guido's announcement at
http://mail.python.org/pipermail/python-dev/2005-September/056846.html:

> The syntax will be
>
> A if C else B
>
> This first evaluates C; if it is true, A is evaluated to give the
> result, otherwise, B is evaluated to give the result.

-- 
Richie Hindle
richie@entrian.com
Received on Sat Oct 15 04:00:16 2005