[issue3263] Odd code fragment in ABC definitions

Raymond Hettinger report at bugs.python.org
Thu Jul 3 01:06:54 CEST 2008


New submission from Raymond Hettinger <rhettinger at users.sourceforge.net>:

In the Hashable ABC, there is a peculiar code fragment:

                if "__hash__" in B.__dict__:
                    if B.__dict__["__hash__"]:
                        return True
                    break

When would the innermost if-statement ever be False?  Is there a reason 
to define __hash__ to be something that evaluates to False?

----------
assignee: gvanrossum
messages: 69140
nosy: gvanrossum, rhettinger
severity: normal
status: open
title: Odd code fragment in ABC definitions
versions: Python 2.5, Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3263>
_______________________________________


More information about the Python-bugs-list mailing list