[BangPypers] Should equality (__eq__) be dependent on the typeof object?

Noufal Ibrahim noufal at nibrahim.net.in
Tue Sep 10 08:30:39 CEST 2013


Shabda Raaj <shabda at agiliq.com> writes:

> See this:
>
> In [3]: OrderedDict(a=1) == {"a": 1}
> Out[3]: True
>
>
>> "Today" (10/Sep) is not equal to "right now" (10/Sep, 11:28 am).
>
>> Makes sense no?
>
> True, but datetime.date(2013, 1, 1) == datetime.datetime(2013, 1, 1)
> should still get me true. (The argument being, date.__eq__ should
> only care about the date components, it shouldn't even care about the
> time components. 

I can see the point in that argument but I don't like it. I'd prefer to
"cast" my datetimes into dates if I wanted to check just the date part. 


[...]


-- 
Cordially,
Noufal
http://nibrahim.net.in


More information about the BangPypers mailing list