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 Eric Lafontaine
Recipients Eric Lafontaine, christian.heimes, docs@python, ezio.melotti, mark.dickinson, nparikh, vstinner
Date 2017-02-08.00:40:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486514441.04.0.909139698314.issue16011@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

For user-defined class, it's up to the class to do the right implementation in my opinion. It's true the description is wrong though. 

x in y means that x exist inside of y (so that the execution of y.__contain__(x) is executed successfully and (I guess) doesn't return None,False or 0).

I'll modify the doc to be :
For user-defined classes which define the __contains__() method, x in y is false if y.__contains__(x) is returning either None,False or 0.  Otherwise, x in y return true.

Regards,
Eric Lafontaine
History
Date User Action Args
2017-02-08 00:40:41Eric Lafontainesetrecipients: + Eric Lafontaine, mark.dickinson, vstinner, christian.heimes, ezio.melotti, docs@python, nparikh
2017-02-08 00:40:41Eric Lafontainesetmessageid: <1486514441.04.0.909139698314.issue16011@psf.upfronthosting.co.za>
2017-02-08 00:40:41Eric Lafontainelinkissue16011 messages
2017-02-08 00:40:40Eric Lafontainecreate