[Python-Dev] os.getmtime now returns a float? (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Tue Jun 20 00:42:40 CEST 2006
- Previous message: [Python-Dev] os.getmtime now returns a float?
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Gregory P. Smith wrote:
os.path.getmtime returns a float on linux (2.5a2/b1 HEAD); in 2.4 it returned an int. this change makes sense, its what time.time returns.
should there be a note in Misc/NEWS or whatsnew mentioning this minor change (or did i miss it)? It breaks code that unintentionally depended on it returning an int.
There is an entry in Misc/NEWS:
- stat_float_times is now True.
The change was originally announced in
http://www.python.org/doc/2.3/whatsnew/node18.html
which says
During testing, it was found that some applications will break if time stamps are floats. For compatibility, when using the tuple interface of the stat_result time stamps will be represented as integers. When using named fields (a feature first introduced in Python 2.2), time stamps are still represented as integers, unless os.stat_float_times() is invoked to enable float return values:
os.stat("/tmp").stmtime 1034791200 os.statfloattimes(True) os.stat("/tmp").stmtime 1034791200.6335014
In Python 2.4, the default will change to always returning floats.
Regards, Martin
- Previous message: [Python-Dev] os.getmtime now returns a float?
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]