Ezio Melotti added the comment: http://docs.python.org/py3k/reference/datamodel.html#object.__contains__ says that __contain__ "Should return true if item is in self, false otherwise.". Here the lowercase true and false mean any true or false value, not just True and False and it's indeed possible to return any value. The fact that 'in' only returns True/False, possibly converting the return value of __contains__, should be documented in the 'in' documentation. http://docs.python.org/py3k/reference/expressions.html#membership-test-detai... says "For user-defined classes which define the __contains__() method, x in y is true if and only if y.__contains__(x) is true.". This could be changed to say that the return value is converted to True/False. ---------- keywords: +easy nosy: +ezio.melotti stage: -> needs patch versions: +Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16011> _______________________________________