Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:
I cannot reproduce your final example: Python 2.7a0 (trunk, Aug 4 2009, 12:07:15) >>> from collections import OrderedDict [41375 refs] >>> if (OrderedDict() != None): ... print 'okie' ... else: ... print 'gah' ... okie Both are based on OrderedDict.__eq__ defined as: def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self)==len(other) and \ all(p==q for p, q in zip(self.items(), other.items())) return dict.__eq__(self, other) Other questions about your bug report. * When you refer to odict, do you mean OrderedDict()? * Do you understand that NotImplemented only does its magic in the context of the == or != operator, and it bypassed which you write dict.__eq__ or OrderedDict.__eq__? * Are you clear that bool(NotImplemented) always evaluates to True? Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> from collections import OrderedDict >>> if (OrderedDict() != None): ... print('Okie') ... else: ... print('Gah') Okie Okie ---------- _______________________________________ 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