[issue14127] os.stat and os.utime: allow preserving exact metadata

Larry Hastings report at bugs.python.org
Sun Feb 26 10:43:00 CET 2012


Larry Hastings <larry at hastings.org> added the comment:

Guido proposed st_atime_ns et al.  I'll make an alternate proposal.

I'd like to avoid tying ourselves to ns resolution.  As MvL said: "I don't want to deal with this issue *again* in my lifetime".

If all we want is to facilitate copying the exact metadata from os.stat to os.utime, then we don't really care about conveniently modifying the timestamp.  So I propose we use MvL's suggestion of a tuple of ints.  Either (numerator, denominator) or (seconds, fractional_numerator, fractional_denominator).  (These are mentioned in PEP 410 under the heading "Tuple of ints" as options A and B respectively.)  Name the fields with the suffix "_exact" (e.g. st_mtime_exact).  os.stat and its ilk produce it; os.utime and its ilk consume it.  If people want to monkey with the values and do math, let 'em--consenting adults.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14127>
_______________________________________


More information about the Python-bugs-list mailing list