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:
* 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've merged Yasser's PR (thank you!), but in the review discussion for that, we noticed something else: the total_seconds() documentation mentions the floating point dynamic resolution problem, but doesn't mention using // or divmod() as the fix for that, while the operator table doesn't mention the dynamic resolution problem at all.
So I haven't closed the issue yet, as fixing that feel in-scope for this issue, even though I didn't want to hold up the initial PR for it.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
The text was updated successfully, but these errors were encountered: