Message19070
Logged In: YES
user_id=31435
Don't panic <wink>. "and" doesn't evaluate anything twice.
The subtlety here is that "and" and "or" return one of their
arguments. If x evaluates to false in "x and y", then "x and y"
returns x:
>>> class C:
... def __nonzero__(self): return False
...
>>> x, y = C(), C()
>>> (x and y) is x
True
>>> (x or y) is y
True
>>>
The second evaluation occurs because "if expr:" has to
evaluate expr. That part's got nothing to do with "and", it's
entirely to do with "if".
None of this is going to change, of course. |
|
Date |
User |
Action |
Args |
2007-08-23 14:18:22 | admin | link | issue846564 messages |
2007-08-23 14:18:22 | admin | create | |
|