[Python-Dev] PEP 410 (Decimal timestamp): the implementation is ready for a review (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Feb 15 01:23:17 CET 2012


On Wed, Feb 15, 2012 at 8:29 AM, Barry Warsaw <barry at python.org> wrote:

My primary concern with the PEP is adding to users confusion when they have to handle (at least) 5 different types[*] that represent time in Python.

My key question to those advocating the use of timedelta instead of Decimal:

What should timedelta.total_seconds() return to avoid losing nanosecond precision? How should this be requested when calling the API?

The core "timestamp" abstraction is "just a number" that (in context) represents a certain number of seconds. decimal.Decimal qualifies. datetime.timedelta doesn't - it's a higher level construct that makes the semantic context explicit (and currently refuses to interoperate with other values that are just numbers).

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list