datetime as subclass of date

Ben Finney ben+python at benfinney.id.au
Thu Jan 23 17:14:38 EST 2014


Skip Montanaro <skip at pobox.com> 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 that module, by the way; it
does not represent a specific point on the timeline. So ‘datetime’
inheriting from ‘time’ wouldn't make sense. Just in case anyone was
wondering.

-- 
 \     “There is something wonderful in seeing a wrong-headed majority |
  `\           assailed by truth.” —John Kenneth Galbraith, 1989-07-28 |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list