Lawrence D'Oliveiro writes:
> In message , Alex Hall
> wrote:
>
>> def __eq__(self, obj):
>> if self.a==obj.a and self.b==obj.b: return True
>> return False
>
> Is there a “Useless Use Of ...” award category for these “if then
> return True; else return False” constructs?
Well, remember
In message , Alex Hall
wrote:
> def __eq__(self, obj):
> if self.a==obj.a and self.b==obj.b: return True
> return False
Is there a “Useless Use Of ...” award category for these “if then
return True; else return False” constructs?
--
http://mail.python.org/mailman/listinfo/python-list
Am 19.08.2010 20:53, schrieb Tim Chase:
> On 08/19/10 12:42, Steven D'Aprano wrote:
>> On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote:
>>
>>> def __eq__(self, obj):
>>>if self.a==obj.a and self.b==obj.b: return True
>>>return False
>>
>> That would be the same as:
>>
>> def __eq_
On 08/19/10 12:42, Steven D'Aprano wrote:
On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote:
def __eq__(self, obj):
if self.a==obj.a and self.b==obj.b: return True
return False
That would be the same as:
def __eq__(self, obj):
return self.a==obj.a and self.b==obj.b
Or,
On Thu, 19 Aug 2010 11:00:03 -0400, Alex Hall wrote:
> def __eq__(self, obj):
> if self.a==obj.a and self.b==obj.b: return True
> return False
That would be the same as:
def __eq__(self, obj):
return self.a==obj.a and self.b==obj.b
--
Steven
--
http://mail.python.org/mailman/l
Am 19.08.2010 17:00, schrieb Alex Hall:
> In Python, as I understand it, you can define this behavior.
>
> class c(object):
> def __init__(self, a=1, b=2):
> self.a=a; self.b=b
>
> def __eq__(self, obj):
> if self.a==obj.a and self.b==obj.b: return True
> return False
Yes, but you have t
On 8/19/10, Peter Otten <__pete...@web.de> wrote:
> Karsten Wutzke wrote:
>
>> I have an object which has a list of other complex objects. How do I
>> best achieve a complex "contains" comparison based on the object's
>> class? In Java terms, I'm looking for an equivalent to equals(Object)
>> in Py
On Aug 19, 4:47 pm, Peter Otten <__pete...@web.de> wrote:
> Karsten Wutzke wrote:
> > I have an object which has a list of other complex objects. How do I
> > best achieve a complex "contains" comparison based on the object's
> > class? In Java terms, I'm looking for an equivalent to equals(Object)
Karsten Wutzke wrote:
> I have an object which has a list of other complex objects. How do I
> best achieve a complex "contains" comparison based on the object's
> class? In Java terms, I'm looking for an equivalent to equals(Object)
> in Python. Does a similar thing exist? Directions appreciated.
Hello,
I have an object which has a list of other complex objects. How do I
best achieve a complex "contains" comparison based on the object's
class? In Java terms, I'm looking for an equivalent to equals(Object)
in Python. Does a similar thing exist? Directions appreciated.
Karsten
--
http://ma
10 matches
Mail list logo