[Python-Dev] PEP: New timestamp formats

Glenn Linderman v+python at g.nevcal.com
Fri Feb 3 02:23:00 CET 2012


On 2/2/2012 3:38 PM, Nick Coghlan wrote:
> On Fri, Feb 3, 2012 at 8:37 AM, Glenn Linderman<v+python at g.nevcal.com>  wrote:
>> >  Sorry to bring this up, but the PEP should probably consider another option:
>> >  Introducing a precedent following os.stat_decimal_times().  Like
>> >  os.stat_float_times, it would decide the return types of timestamps from
>> >  os.stat.  Or something along that line.  Having it affect the results of
>> >  time.time would be weird, though.  And the whole design of
>> >  os.stat_float_times smells of something being designed wrong in the first
>> >  place, to need such an API to retain backward compatibility.  But I'm not
>> >  sure it is, even yet, designed for such flexibility.
> We could get away with a global switch for the int->float transition
> because ints and floats interoperate pretty well. The same is not true
> for binary floats and decimal.Decimal.

I agree about the interoperability of the various types, but don't see 
why that doesn't mean a global switch couldn't work, although I'm not 
fond of global switches.

Library code that calls os.stat would have to be ready to handle either 
return value, but could predetermine it by checking the switch state.  
Icky.  But possible.

In any case, mentioning it in the PEP, along with why it is a bad idea, 
is probably a good idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120202/b82df9c2/attachment.html>


More information about the Python-Dev mailing list