Loop-and-a-half (Re: Curious assignment behaviour)

Tim Peters tim.one at home.com
Fri Oct 12 22:34:05 EDT 2001


>     x = if e1 then e2 else e3

[Emile van Sebille]
> Would this fully short circuit evaluation of e2 if not e1

Of course.  It would be "the same as"

    if e1:
        __unspellable_name__ = e2
    else:
        __unspellable_name__ = e3
    x = __unspellable_name__

> (and vv)?

It wouldn't evaluate "vv" at all <wink>.

nor-is-it-limited-to-"x"-etc-ly y'rs  - tim





More information about the Python-list mailing list