Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31404

Re: overriding equals operation

Date 2012-10-16 10:09 -0400
From Dave Angel <d@davea.name>
Subject Re: overriding equals operation
References <76D03718A3233B4C8CC236C169B535B5A23DFDFB43@AUSP01VMBX08.collaborationhost.net>
Newsgroups comp.lang.python
Message-ID <mailman.2279.1350396595.27098.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: overriding equals operation Dave Angel <d@davea.name> - 2012-10-16 10:09 -0400

csiph-web