Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: overriding equals operation

Thread Tools

Re: overriding equals operation

Dave Angel
Posts: n/a
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 (=)



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
overriding equals operation Pradipto Banerjee Python 5 10-17-2012 08:14 AM
Re: overriding equals operation Dwight Hutto Python 0 10-17-2012 01:51 AM
I/O operation, file operation behaviou raan C++ 2 08-16-2007 07:13 PM
Does bit operation always work more efficiently than math operation? david ullua C Programming 13 03-01-2006 11:02 PM
does String.equals breaks the equals contract? Edward A Thompson Java 4 02-11-2004 11:33 PM