[Python-Dev] PEP: New timestamp formats
Nick Coghlan
ncoghlan at gmail.com
Thu Feb 2 21:48:44 CET 2012
On Feb 3, 2012 2:59 AM, "Barry Warsaw" <barry at python.org> wrote:
>
> On Feb 02, 2012, at 11:07 PM, Nick Coghlan wrote:
>
> >Yup, that's why your middle-ground approach didn't make any sense to
> >me. Returning Decimal when a flag is set to request high precision
> >values actually handles everything (since any epoch related questions
> >only arise later when converting the decimal timestamp to an absolute
> >time value).
>
> Guido really dislikes APIs where a flag changes the return type, and I
agree
> with him. It's because this is highly unreadable:
>
> results = blah.whatever(True)
>
> What the heck does that `True` do? It can be marginally better with a
> keyword-only argument, but not much.
Victor's patch passes in the return type rather than a binary flag, thus
avoiding this particular problem.
> I haven't read the whole thread so maybe this is a stupid question, but
why
> can't we add a datetime-compatible higher precision type that hides all
the
> implementation details?
>
> -Barry
It's not a stupid question, but for backwards compatibility, what we would
actually need is a version of Decimal that implicitly interoperates with
binary floats. That's... not trivial.
Cheers,
Nick
--
Sent from my phone, thus the relative brevity :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120203/39038b05/attachment.html>
More information about the Python-Dev
mailing list