[issue1714448] if something as x:

Steven D'Aprano report at bugs.python.org
Sun Mar 15 01:37:54 CET 2009


Steven D'Aprano <steve at pearwood.info> added the comment:

Regarding the proposed syntax:

if (f() == 'spam') -> name:
   newname = name.replace('p', 'h') 

Surely that should assign the *bool* result of comparing f() 
with 'spam' to name? Doing anything else is opening the door to a 
world of pain.

if (f() == 'spam') -> name  # binds name=f()
if ('spam' == f()) -> name  # binds 'spam' to name?
if (f() == g()) -> name  # binds what to name?
if (f() or g()) -> name  # binds what to name?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1714448>
_______________________________________


More information about the Python-bugs-list mailing list