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

2013-09-10 Thread Noufal Ibrahim
Shabda Raaj sha...@agiliq.com writes: I'd expect it to be False. There will be a small amount of time between the two invocations and the time will change Ok, that makes sense. Should have written a better test case. What about this. datetime.datetime(2013, 1, 1) == datetime.date(2013, 1,

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

2013-09-10 Thread Noufal Ibrahim
Noufal Ibrahim nou...@nibrahim.net.in writes: Shabda Raaj sha...@agiliq.com writes: I'd expect it to be False. There will be a small amount of time between the two invocations and the time will change Ok, that makes sense. Should have written a better test case. What about this.

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

2013-09-10 Thread Shabda Raaj
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

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

2013-09-10 Thread Noufal Ibrahim
Shabda Raaj sha...@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

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

2013-09-09 Thread Shabda Raaj
Eg: See this: http://nbviewer.ipython.org/5151306 I was expecting datetime.date.today() == datetime.datetime.today() to give me a True. (It is false). For example this works as I expect: http://nbviewer.ipython.org/5151398 However looks like __eq__ is doing a isinstance check - I would

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

2013-09-09 Thread Noufal Ibrahim
Shabda Raaj sha...@agiliq.com writes: Eg: See this: http://nbviewer.ipython.org/5151306 I was expecting datetime.date.today() == datetime.datetime.today() to give me a True. (It is false). I'd expect it to be False. There will be a small amount of time between the two invocations and the

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

2013-09-09 Thread Shabda Raaj
I'd expect it to be False. There will be a small amount of time between the two invocations and the time will change Ok, that makes sense. Should have written a better test case. What about this. datetime.datetime(2013, 1, 1) == datetime.date(2013, 1, 1) False datetime.datetime.today() ==