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 loewis
Recipients
Date 2003-11-24.22:28:23
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=21627

This is clearly not a bug. I'm closing it as "works for me":
the "and" operator does *not* evaluate its argument twice
(as Tim explains, and in contrast to what the subject claims).

That the semantics of the if statement (*not* the "and"
expression) is surprising if the result of __nonzero__
changes in subsequent invokcations might be a fact (strictly
speaking, whether you are surprised depends on what you
expect). However, the behaviour of Python is not at all
random in itself, and there are very good reasons for things
being just the way they are. 

If changing zero-ness of objects surprises you: Don't do
that, then.
History
Date User Action Args
2007-08-23 14:18:22adminlinkissue846564 messages
2007-08-23 14:18:22admincreate