New submission from Christopher Egner <ceg...@yahoo-inc.com>: The current definition for odict.__eq__ is def __eq__(self, other): if isinstance(other, OrderedDict): return all(p==q for p, q in _zip_longest(self.items(), other.items())) return dict.__eq__(self, other)
The current behavior of NotImplemented is: >>> if( NotImplemented ): ... print 'foo' foo >>> dict.__eq__( {}, None ) NotImplemented >>> if ( dict.__eq__( {}, None ) ): ... print 'oops' oops The surprising behavior is: >>> if ( OrderedDict() != None ): ... print 'okie' ... else: ... print 'gah!' gah! As best I understand it, normally other (in this case None) would be given the chance to evaluate other.__eq__( OrderedDict() ), but this doesn't seem to be happening. ---------- components: None messages: 91752 nosy: cegner severity: normal status: open title: PEP 372 odict.__eq__ behaves incorrectly type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6737> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com