[Python-Dev] Proposing an alternative to PEP 410 (original) (raw)

Larry Hastings larry at hastings.org
Thu Feb 23 22:28:14 CET 2012


I've been meditating on the whole os.stat mtime representation thing. Here's a possible alternative approach.

I realize datetime objects aren't a drop-in replacement for floats (or ints). In particular their str/repr representations are much more ornate. So I'd expect some breakage.

Personally I think the adding/subtracting ints change is a tiny bit smelly--but this is a practicality beating purity thing. I propose making it non-default behavior just to minimize the effects of the change. Similarly, I realize os.stat_float_times was always a bit of a hack, what with it being global state and all. However the approach has the virtue of having worked in the past.

I disagree with PEP 410's conclusions about the suitability of datetime as a timestamp object. I think "naive" datetime objects are a perfect fit. Specficially addressing PEP 410's concerns:

Perhaps someone else can propose something even better,

//arry/



More information about the Python-Dev mailing list