Where does that module live in the Python install?

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts




inspect module to the rescue:
import inspect
import datetime

for name, data in inspect.getmembers(datetime):
    print name, data

Wait for output...
MAXYEAR 9999
MINYEAR 1
__doc__ Fast implementation of the datetime type.
__file__ /usr/lib/python2.7/lib-dynload/datetime.x86_64-linux-gnu.so
__name__ datetime
__package__ None
date <type 'datetime.date'>
datetime <type 'datetime.datetime'>
datetime_CAPI <capsule object "datetime.datetime_CAPI" at 0x7f39d93a7960>
time <type 'datetime.time'>
timedelta <type 'datetime.timedelta'>
tzinfo <type 'datetime.tzinfo'>

Crud. Not exactly helpful.
But source is available :-)



[æ]