[Python-Dev] Store timestamps as decimal.Decimal objects (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Wed Feb 1 03:35:14 CET 2012
- Previous message: [Python-Dev] Store timestamps as decimal.Decimal objects
- Next message: [Python-Dev] Store timestamps as decimal.Decimal objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 1 Feb 2012 10:35:08 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote:
With this approach, API usage might end up looking something like: >>> time.time() 1328006975.681211 >>> time.time(convert=time.asfloat) 1328006975.681211 >>> time.time(convert=time.asint) 1328006979 >>> time.time(convert=time.astuple) (1328006975, 681211, -9) >>> time.time(convert=decimal.Decimal.fromcomponents) Decimal('1328006983.761119000')
It strikes me as inelegant to have to do so much typing for something
as simple as getting the current time. We should approach the
simplicity of time.time(format='decimal')
or
time.decimal_time()
.
(and I think the callback thing is overkill)
Regards
Antoine.
- Previous message: [Python-Dev] Store timestamps as decimal.Decimal objects
- Next message: [Python-Dev] Store timestamps as decimal.Decimal objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]