New submission from Eric Snow:

How well does OrderedDict need to behave in the face of keys with unstable 
hashes (e.g. define __hash__ with varying results across calls)?  I would 
expect the behavior to be undefined (though non-crashing).  Here's an example 
of a misbehaving key:

    class Key:
        def __hash__(self):
            return randrange(10000)

FWIW, dict does pretty well even with bad keys.  The pure Python OrderedDict 
does okay.

----------
assignee: eric.snow
components: Library (Lib)
messages: 244727
nosy: eric.snow, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: OrderedDict behavior is unclear with misbehaving keys.
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24370>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to