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 gvanrossum
Recipients _doublep, christian.heimes, gvanrossum
Date 2007-11-09.00:23:00
SpamBayes Score 0.007685935
Marked as misclassified No
Message-id <1194567781.3.0.213086975677.issue1393@psf.upfronthosting.co.za>
In-reply-to
Content
It's still odd though.  Why does object() == Anything() pass control to
the right hand side, while (lambda: None) == Anything() doesn't? 
There's no definition of equality in PyFunction_Type, so it would seem
to fall back on the definition in PyBaseObject_Type, which I would
expect to return False from the code in object_richcompare()...

[...gdb...]

OK, here's the solution of the mystery.  do_richcompare() ends up taking
the swapped code path for object() == Anything(), but not for function
objects.  This is because Anything() is a subclass of object, but not of
<function>.

Perhaps the solution is to change object_richcompare() to return
NotImplemented instead of returning False?  Or perhaps even remove
object_richcompare() altogether, since it doesn't do anything that
do_richcompare() doesn't know how to do...
History
Date User Action Args
2007-11-09 00:23:01gvanrossumsetspambayes_score: 0.00768594 -> 0.007685935
recipients: + gvanrossum, christian.heimes, _doublep
2007-11-09 00:23:01gvanrossumsetspambayes_score: 0.00768594 -> 0.00768594
messageid: <1194567781.3.0.213086975677.issue1393@psf.upfronthosting.co.za>
2007-11-09 00:23:01gvanrossumlinkissue1393 messages
2007-11-09 00:23:00gvanrossumcreate