overriding equals operation

Dave Angel d at davea.name
Tue Oct 16 10:09:21 EDT 2012


On 10/16/2012 09:51 AM, Pradipto Banerjee wrote:
> I am trying to define class, where if I use a statement a = b, then instead of "a" pointing to the same instance as "b", it should point to a copy of "b", but I can't get it right.
>
>

The __eq__ method is called for equals comparison, like
      if myinst == otherobj:

There are no hooks for the binding operator (=)




-- 

DaveA




More information about the Python-list mailing list