Why does Python have both a module and a class called datetime? -
Why does Python have both a module and a class called datetime? -
i'm getting confused whether have imported datetime
datetime
, or whether i've imported datetime
. if see in code datetime
beingness used, can't tell whether module datetime or class datetime. annoying. can do?
also, pep 8 states: "class names should utilize capwords convention."
it help if classes in datetime
module called datetime
, date
, , time
.
since question set on hold "unclear you're asking", i've decided edit , write more. honest, wasn't sure asking either -- found repeatedly beingness tripped issue , wanted feedback. think did helpful advice, though, tdelaney:
personally import datetime dt
, utilize dt.datetime
, etc... because want maintain original class names while minimizing confusion module name.
it might nice have more consistent naming. standard python library , classically thought of python's "built in" types abide neither pep-8 or strict model of consistency. of standard types (e.g. int
, float
, str
, list
, , dict
) lower-case. extensions of dict
capworded, ordereddict
. companion defaultdict
not. there number of info types named same modules, such array.array
, datetime.datetime
. major rewrite of python 3 moved modules around, didn't homogenize or reorganize class names great degree.
so...just larn live it. it's historical fact, , not alter soon.
python datetime
Comments
Post a Comment