[Python-Dev] PEP 410 (Decimal timestamp): the implementation is ready for a review

Guido van Rossum guido at python.org
Thu Feb 16 05:12:12 CET 2012


On Wed, Feb 15, 2012 at 7:28 PM, Larry Hastings <larry at hastings.org> wrote:
>
> On 02/15/2012 09:43 AM, Guido van Rossum wrote:
>>
>> *Apart* from the specific use case of making an exact copy of a
>> directory tree that can be verified by other tools that simply compare
>> the nanosecond times for equality,
>
>
> A data point on this specific use case.  The following code throws its
> assert ~90% of the time in Python 3.2.2 on a modern Linux machine (assuming
> "foo" exists and "bar" does not):
>
>   import shutil
>   import os
>   shutil.copy2("foo", "bar")
>   assert os.stat("foo").st_mtime == os.stat("bar").st_mtime
>
> The problem is with os.utime.  IIUC stat() on Linux added nanosecond
> atime/mtime support back in 2.5.  But the corresponding utime() functions to
> write nanosecond atime/mtime didn't appear until relatively recently--and
> Python 3.2 doesn't use them.  With stat_float_times turned on, os.stat
> effectively reads with ~100-nanosecond precision, but os.utime still only
> writes with microsecond precision.  I fixed this in trunk last September
> (issue 12904); os.utime now preserves all the precision that Python
> currently conveys.
>
> One way of looking at it: in Python 3.2 it's already pretty bad and almost
> nobody is complaining.  (There's me, I guess, but I scratched my itch.)

So, essentially you fixed this particular issue without having to do
anything as drastic as the proposed PEP...

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list