Movatterモバイル変換
[0]ホーム
[Python-Dev] PEP 410, 3rd revision, Decimal timestamp
Victor Stinnervictor.stinner at gmail.com
Sat Feb 18 04:22:30 CET 2012
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 thatfractions.Fraction is very close to this format except that it can becoerced to float and arithmetic on Fraction and float is allowed(return float). My implementation of the PEP implements something likeFraction in C, but something more specific to timestamps (e.g. withoutarithmetic).I don't know yet if Fraction is better or worse than Decimal. I see atleast one drawback, str(Fraction): 5576475333606653/4194304 is lessreadable 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! :-DVictor
More information about the Python-Devmailing list
[8]ページ先頭