Re: instance comparison

2008-07-24 Thread Petite Abeille
On Jul 24, 2008, at 7:53 PM, King wrote: The the class is not subclass of another one. Problem still persist. The code is pretty huge and I am trying to post the information as clear as possible. Mark V. Shaney, from Dissociated Press, I presume? -- PA. http://alt.textdrive.com/nanoki/ -- ht

Re: instance comparison

2008-07-24 Thread Fredrik Lundh
King skrev: The the class is not subclass of another one. Problem still persist. The code is pretty huge and I am trying to post the information as clear as possible. feel free to *add* stuff to the following example until it breaks, if that's easier: >>> class Spam: ... def __init__(se

Re: instance comparison

2008-07-24 Thread King
No, The the class is not subclass of another one. Problem still persist. The code is pretty huge and I am trying to post the information as clear as possible. -- http://mail.python.org/mailman/listinfo/python-list

Re: instance comparison

2008-07-24 Thread Bruno Desthuilliers
King a écrit : The only methods I do have in class is __init__ and __str__. Is your class subclassing another one ? -- http://mail.python.org/mailman/listinfo/python-list

Re: instance comparison

2008-07-24 Thread Fredrik Lundh
King wrote: The only methods I do have in class is __init__ and __str__. How ever inst1 and inst2 is coming from a dictionary where I stored them with a unique id. inst1 = stored[id] inst2 = stored[id] Is this makes a difference? unlikely (well, if that's the literal code, both variables wil

Re: instance comparison

2008-07-24 Thread King
The only methods I do have in class is __init__ and __str__. How ever inst1 and inst2 is coming from a dictionary where I stored them with a unique id. inst1 = stored[id] inst2 = stored[id] Is this makes a difference? I will rip down the piece of code giving me problem and post. -- http://mail.p

Re: instance comparison

2008-07-24 Thread Fredrik Lundh
King wrote: Is this mean when you have overridden __str__ method then it comapre with results of __str__ or else it will comapre whether they are the same instances? Comparisons uses __cmp__ or the rich comparison set; see http://docs.python.org/ref/customization.html for details. Sets

Re: instance comparison

2008-07-24 Thread John Machin
On Jul 24, 6:50 pm, King <[EMAIL PROTECTED]> wrote: > I am facing a problem where I am really confused about it. > > I am trying to compare to instances using: > > if inst1 == inst2 > > These instances have a overridden method __str__ which returns same > string. The condition result is true althou