jeudi 23 janvier 2014

Re: datetime as subclass of date topic




In article <(E-Mail Removed)>,
Ben Finney <(E-Mail Removed)> wrote:

> Skip Montanaro <(E-Mail Removed)> writes:
>
> > […] I was asking [Python] if a datetime instance was an instance of a
> > date. Which, it turns out, it is.

>
> Yep. Makes sense, since ‘datetime’ can do everything ‘date’ can do, and
> is conceptually a subset of the same concept.


That's reasonable, but given that, it's weird that date(2014, 1, 23) ==
datetime(2014, 1, 23) is False. You would think it should be True, in
the same way that 1 + 0j == 1 is True.





Aucun commentaire:

Enregistrer un commentaire