Re: overriding equals operation

2012-10-20 Thread Joshua Landau
On 17 October 2012 09:14, Mark Lawrence wrote: > On 17/10/2012 05:16, 8 Dihedral wrote: > >> What you really want is b=a.copy() >> not b=a to disentangle two objects. >> >> __eq__ is used in the comparison operation. >> >> > The winner Smartest Answer by a Bot Award 2012 :) Something seems

Re: overriding equals operation

2012-10-17 Thread Mark Lawrence
On 17/10/2012 05:16, 8 Dihedral wrote: What you really want is b=a.copy() not b=a to disentangle two objects. __eq__ is used in the comparison operation. The winner Smartest Answer by a Bot Award 2012 :) -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: overriding equals operation

2012-10-16 Thread 88888 Dihedral
Pradipto Banerjee於 2012年10月16日星期二UTC+8下午9時59分05秒寫道: > 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. > > > > Currently, I have the following: > > > > ---

Re: overriding equals operation

2012-10-16 Thread Dwight Hutto
On Tue, Oct 16, 2012 at 9: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. > > Currently, I have the following: > > > > c

Re: overriding equals operation

2012-10-16 Thread Nobody
On Tue, 16 Oct 2012 08:51:46 -0500, 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. It cannot be done. Name binding ("variable = val

Re: overriding equals operation

2012-10-16 Thread Thomas Rachel
Am 16.10.2012 15:51 schrieb Pradipto Banerjee: 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. This is not possible. Currently, I have the following:

Re: overriding equals operation

2012-10-16 Thread Dave Angel
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

overriding equals operation

2012-10-16 Thread Pradipto Banerjee
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. Currently, I have the following: class myclass(object): def __init__(self, name='')