One thing that always reinforced my notion that
issubclass(datetime.datetime, datetime.date) should be False is that
the presence of of date and time methods gives me a mental image of
delegation, not inheritance. That is, it "feels" like a datetime
object is the aggregation of a date object and a
Roy Smith writes:
> Ben Finney wrote:
>
> > 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 shou
In article ,
Ben Finney wrote:
> Skip Montanaro 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
Skip Montanaro 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.
The same is not true of the ‘time’ type from t
This took my by surprise just now:
>>> import datetime
>>> now = datetime.datetime.now()
>>> isinstance(now, datetime.datetime)
True
>>> isinstance(now, datetime.time)
False
>>> isinstance(now, datetime.date)
True
>>> issubclass(datetime.datetime, datetime.date)
True
I'd never paid any attention