Title: os.utime should allow None values for ATIME or MTIME
Type: enhancement Stage: resolved
Components: IO Versions: Python 2.5
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, purpleidea
Priority: normal Keywords:

Created on 2009-06-10 20:06 by purpleidea, last changed 2009-06-12 13:25 by purpleidea. This issue is now closed.

Messages (3)
msg89227 - (view) Author: James (purpleidea) Date: 2009-06-10 20:06
Hi, in using os.utime, it's nice that you can specify `None' for the
second argument. However it would be even `nicer' to be able to specify
None for either (or potentially both) values for the argument in the
tuple. to emulate this, i've been using os.stat to read the value
beforehand, and just use os.utime with the new value, and the old one
pulled from stat()


os.utime('/dev/pts/1', None) WORKS
os.utime('/dev/pts/1') SHOULD WORK (allow second argument to default to
os.utime('/dev/pts/1', (time.time(), None)) SHOULD WORK
os.utime('/dev/pts/1', (None, None)) SHOULD WORK
os.utime('/dev/pts/1', (None, time.time())) I GUESS SHOULD WORK

ps: if this is a feature you'd agree with, let me know any maybe i can
*try* to write a patch?
msg89272 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-06-12 12:01
Functions of the os module that expose POSIX functions should have the
same interface as the system function; and they should not call other
system function.
Here, 'None' is accepted for the second argument only because the POSIX
utime() function accepts a NULL pointer.

Your need is certainly valid; but such a behavior does not belong to the
os module, which has to remain low-level.
msg89277 - (view) Author: James (purpleidea) Date: 2009-06-12 13:25
very well, this is a good point.
i'm guessing nobody would every accept a patch for upstream utime? (in c)
thanks for your comment.
Date User Action Args
2009-06-12 13:25:02purpleideasetmessages: + msg89277
2009-06-12 12:01:52amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg89272

resolution: rejected
stage: resolved
2009-06-10 20:06:31purpleideacreate