Python 2.2b1 hashable dictionary bug?

Tim Peters tim.one at home.com
Sun Oct 28 22:30:05 EST 2001


[Mark J]
> Since I haven't had a good hit rate at detecting bugs vs. features, I
> thought I'd post here before filing a bug report at SourceForge.

Suspected bugs have a much better chance of being seen if posted to
SourceForge.  You don't lose any points for reporting something suspicious
that turns out not to be a bug -- you simply get a definitive answer more
quickly, most of the time.  This one is a bug, and I opened a bug report for
you:

<http://sf.net/tracker/index.php?func=detail&aid=475877&group_id=5470&atid=1
05470>

> Python 2.2b1 (#1, Oct 19 2001, 23:11:09)
> [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> class D(dictionary): pass
> ...
> >>> d = {}
> >>> d2 = D()
> >>> d[d2] = "dictionary used as key"
> >>>

You can stop there -- objects of builtin mutable types should never be
usable as dict keys.





More information about the Python-list mailing list