homepage

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 exarkun
Recipients exarkun
Date 2014年05月01日.14:31:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398954687.6.0.574462939929.issue21408@psf.upfronthosting.co.za>
In-reply-to
Content
$ ~/Projects/cpython/3.4/python -c '
class Foo(object):
 def __ne__(self, other):
 return "yup"
 def __eq__(self, other):
 return "nope"
class Bar(object):
 pass
 
print(object() != Foo(), object() == Foo())
print(Bar() != Foo(), Bar() == Foo())
'
yup nope
False nope
$
The output I would expect from this is
 yup nope
 yup nope
That is, even when the type of the left-hand argument is not a base class of the type of the right-hand argument, delegation to the right-hand argument is sensible if the left-hand argument does not implement the comparison.
Note that the output also demonstrates that this is already the behavior for `==`. Only `!=` seems to suffer from this issue.
History
Date User Action Args
2014年05月01日 14:31:27exarkunsetrecipients: + exarkun
2014年05月01日 14:31:27exarkunsetmessageid: <1398954687.6.0.574462939929.issue21408@psf.upfronthosting.co.za>
2014年05月01日 14:31:27exarkunlinkissue21408 messages
2014年05月01日 14:31:27exarkuncreate

AltStyle によって変換されたページ (->オリジナル) /