Question about isinstance()
ramen at spoomusic.com
Thu Jan 26 21:19:59 CET 2006
On Thu, 26 Jan 2006, Dave Benjamin wrote:
> On Thu, 26 Jan 2006, Rocco Moretti wrote:
>>> You were better off with what you had before. Equality in this case is
>>> left completely open-ended, and as a result, there is no way that you can
>>> guarantee that "a == b" is the same as "b == a" if "a" is a "foo" and "b"
>>> is of unknown type. This can lead to bizarre and unpredictable behavior.
>> Mind explaining that better? b == a *always* calls b.__eq__(a), if it
>> exists. What a.__eq__(b) is doesn't matter at that point. So you have the
>> same problems either way.
> Right, but we don't know what "b.__eq__" does, since "b" could be anything,
> if it exists at all. So, it's quite possible that "a == b", since "a.__eq__"
By "it" here, I mean "b.__eq__".
More information about the Python-list