osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

datetime gotcha


> Why is a dtm instance also an instance of dt?

The datetime type is, in fact, a subclass of the date type:

>>> import datetime
>>> datetime.date.__bases__
(<class 'object'>,)
>>> datetime.datetime.__bases__
(<class 'datetime.date'>,)
>>> datetime.time.__bases__
(<class 'object'>,)

Skip