[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 410, 3rd revision, Decimal timestamp

As asked by Martin, I tried to list *all* objections and alternatives.

> ?* A: (numerator, denominator)
> ? * value = numerator / denominator
> ? * resolution = 1 / denominator
> ? * denominator > 0
> (...)
> Tuple of integers have been rejected because they don't support
> arithmetic operations.

Oh, after writing the 3rd version of this PEP, I realized that
fractions.Fraction is very close to this format except that it can be
coerced to float and arithmetic on Fraction and float is allowed
(return float). My implementation of the PEP implements something like
Fraction in C, but something more specific to timestamps (e.g. without

I don't know yet if Fraction is better or worse than Decimal. I see at
least one drawback, str(Fraction): 5576475333606653/4194304 is less
readable than 1329535325.43341.

> ?* Ruby (1.9.3), the `Time class <http://ruby-doc.org/core-1.9.3/Time.html>`_
> ? supports picosecond (10\ :sup:`-12`)

We must do better than Ruby: support arbritrary precision! :-D