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 afoglia
Recipients afoglia, georg.brandl
Date 2009-06-22.19:27:52
SpamBayes Score 5.2735594e-15
Marked as misclassified No
Message-id <1245698874.13.0.640137390853.issue6324@psf.upfronthosting.co.za>
In-reply-to
Content
I was debugging a class where I defined __getitem__ and __iter__, but 
not __contains__.  The documentation describing this case (at the end of 
section 5.9) is old and hasn't been updated for the iterator protocol.

It should read something like:

"For user-defined classes which do not define __contains__() and do 
define __iter__() or __getitem__(), x in y is true if and only if there 
is a value z reachable from iter(y) before iter(y) throws a 
StopIteration exception. (If any other exception is raised, it is as if 
in raised that exception)."

Or something better worded.

(I'm using Python 2.5, but I really doubt things have changes in 2.6 or 
2.7.  I don't know enough about 3.0 to know either way.)
History
Date User Action Args
2009-06-22 19:27:54afogliasetrecipients: + afoglia, georg.brandl
2009-06-22 19:27:54afogliasetmessageid: <1245698874.13.0.640137390853.issue6324@psf.upfronthosting.co.za>
2009-06-22 19:27:52afoglialinkissue6324 messages
2009-06-22 19:27:52afogliacreate