Message336765
In a recent python-dev thread, there was some confusion about how to get something like `timedelta.total_microseconds()`. There is already an existing, supported idiom for this, which is that `timedelta` implements division:
td = timedelta(hours=1)
num_microseconds = td / timedelta(microseconds=1)
In this e-mail ( https://mail.python.org/pipermail/python-dev/2019-February/156351.html ), Nick Coghlan proposed that we update the documentation and there were no objections, quoting:
* In the "Supported Operations" section of https://docs.python.org/3/library/datetime.html#timedelta-objects,
change "Division (3) of t2 by t3." to "Division (3) of overall
duration t2 by interval unit t3."
* In the total_seconds() documentation, add a sentence "For interval units
other than seconds, use the division form directly (e.g. `td / timedelta(microseconds=1)`)"
I am starting this issue to track that change. |
|
Date |
User |
Action |
Args |
2019-02-27 14:54:37 | p-ganssle | set | recipients:
+ p-ganssle, ncoghlan, belopolsky, docs@python |
2019-02-27 14:54:37 | p-ganssle | set | messageid: <1551279277.78.0.420201199405.issue36138@roundup.psfhosted.org> |
2019-02-27 14:54:37 | p-ganssle | link | issue36138 messages |
2019-02-27 14:54:37 | p-ganssle | create | |
|