PEP308: Yet another syntax proposal

Bengt Richter bokr at oz.net
Tue Feb 11 02:34:08 EST 2003


On Mon, 10 Feb 2003 11:16:54 -0800, David Eppstein <eppstein at ics.uci.edu> wrote:

>On 2/10/03 7:36 PM +0100 holger krekel <pyth at devel.trillke.net> wrote:
>>> My feeling is that the reason for short circuiting isn't so much because
>>> of side effects (I think we should try to keep expressions as free of
>>> side effects as possible) but because one or both of the two sides may
>>> be undefined and raise an exception if the guard condition is not met.
>>
>> right.  in which case learning about and/or (which you have to anyway)
>> often helps.  Because of the "y is false" problem in "x and y or z"
>> there are some cases where it doesn't fit.  Do we have real code
>> examples for them?
>
>I posted one several hundred messages back:
>   cols[i] if i >= 0 else None
>
    0<=i<len(cols) -> cols[i] -> None

would be even safer, using cond -> trueExpr -> falseExpr

Regards,
Bengt Richter




More information about the Python-list mailing list