[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

Alexander Belopolsky report at bugs.python.org
Wed Apr 21 20:46:26 CEST 2010


Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:

On Wed, Apr 21, 2010 at 2:33 PM, Jess Austin <report at bugs.python.org> wrote:
..
> It might seem like the latter behavior is marginally better, but really this is just a mess, since a date-datetime comparison TypeErrors in all
> directions.  I appreciate Alexander's more experienced perspective, but it's not obvious to me that this problem is insoluble simply due to OOP
> algebra.  I'm going to keep tinkering with this to see if there isn't a way to satisfy his concerns AND fix these bugs WITHOUT breaking the
> established (and admittedly anti-OOP) behavior that dates are not equal to datetimes.
>

I certainly don't have a proof that this is impossible, so best of
luck.  Note, however that the problematic behavior is due to D/DT
classes implementor's choice not to derive DT from D.  Whether
resulting violation of the symmetry of equality is a bug in python or
D/DT implementation is at least an open question.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5516>
_______________________________________


More information about the Python-bugs-list mailing list