A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-February/116056.html below:

[Python-Dev] Store timestamps as decimal.Decimal objects

[Python-Dev] Store timestamps as decimal.Decimal objects [Python-Dev] Store timestamps as decimal.Decimal objectsAntoine Pitrou solipsis at pitrou.net
Wed Feb 1 03:35:14 CET 2012
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.as_float)
>    1328006975.681211
>    >>> time.time(convert=time.as_int)
>    1328006979
>    >>> time.time(convert=time.as_tuple)
>    (1328006975, 681211, -9)
>    >>> time.time(convert=decimal.Decimal.from_components)
>    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.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4