This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients cegner, rhettinger
Date 2009-08-19.23:15:27
SpamBayes Score 1.3072876e-13
Marked as misclassified No
Message-id <1250723729.03.0.989793518387.issue6737@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-08-19 23:15:29rhettingersetrecipients: + rhettinger, cegner
2009-08-19 23:15:29rhettingersetmessageid: <1250723729.03.0.989793518387.issue6737@psf.upfronthosting.co.za>
2009-08-19 23:15:27rhettingerlinkissue6737 messages
2009-08-19 23:15:27rhettingercreate