For review: PEP 308 - If-then-else expression

Andrew Koenig ark at research.att.com
Fri Feb 7 16:39:30 EST 2003


Gerrit> Guido van Rossum schreef op vrijdag  7 februari om 18:16:27 +0000:
>> x if C else y if D else z <==> x if C else (y if D else z)

Gerrit> Doesn't this equal ((z ,y)[bool(D)], x)[bool(C)]? I think it's
Gerrit> good enough.

No, it's not equal because your version evaluates x, y, and z in
all circumstances.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list