[issue1714448] if something as x:
report at bugs.python.org
Sun Mar 15 01:47:43 CET 2009
Jervis Whitley <jervisau at gmail.com> 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.
You are correct. It does assign the result of the bool. I have
made an error in creating the example. This is what happens when
I copy and paste and don't check the result.
if f -> name:
# use name, (pointless example but in line with the OP's suggestion)
Thanks for picking this up.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list