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/2019-February/156292.html below:

[Python-Dev] datetime.timedelta total_microseconds

[Python-Dev] datetime.timedelta total_microseconds [Python-Dev] datetime.timedelta total_microsecondsRichard Belleville rbellevi at google.com
Thu Feb 14 00:05:54 EST 2019
In a recent code review, the following snippet was called out as
reinventing the
wheel:

_MICROSECONDS_PER_SECOND = 1000000


def _timedelta_to_microseconds(delta):
  return int(delta.total_seconds() * _MICROSECONDS_PER_SECOND)


The reviewer thought that there must already exist a standard library
function
that fulfills this functionality. After we had both satisfied ourselves
that we
hadn't simply missed something in the documentation, we decided that we had
better raise the issue with a wider audience.

Does this functionality already exist within the standard library? If not,
would
a datetime.timedelta.total_microseconds function be a reasonable addition? I
would be happy to submit a patch for such a thing.

Richard Belleville
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190213/1586f59c/attachment.html>
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