This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2003-11-21.19:29:24
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 14:18:22adminlinkissue846564 messages
2007-08-23 14:18:22admincreate