[Patches] utime(path, NULL)
Guido van Rossum
guido@python.org
Mon, 01 May 2000 09:02:32 -0400
> On some OSes (Solaris and Linux at least), the second argument to
> utime() can be NULL, which sets the atime and mtime of the file to the
> current time. Here is a patch that gives this functionality if second
> argument to os.utime() is omitted. E.g.
>
> import os
> os.utime(path)
>
> ==
>
> #include <utime.h>
> utime(path, NULL)
>
> One minor bogosity: because of the way default arguments work for
> longs, os.utime(path) is equivalent to os.utime(path, (-1, -1)). Is
> this a big deal? Should other magic be used instead?
The logical translation would be to require passing in None rather
than leaving out the argument. The (-1, -1) default is ugly.
--Guido van Rossum (home page: http://www.python.org/~guido/)