-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Floor division between TimeDelta
s
#197
Comments
Agree, this makes sense. Let me know if you'd like to take a stab at it yourself. Otherwise, I'll include it in an upcoming release. |
It'd also be consistent to implement That said, it may also be worth reconsidering whether Observe this potentially confusing behavior in the stdlib: >>> timedelta(microseconds=4) / 3
timedelta(microseconds=1)
>>> timedelta(microseconds=4) / 7
timedelta(microseconds=1)
>>> timedelta(microseconds=4) / 8
timedelta(microseconds=0) Perhaps only |
I feel like
Hmm, that seems more confusing. |
It'd truncate to nanoseconds, but you're right that this is probably too implicit. In theory, I think the purest solution is to have a method like For the users that value practicality over purity, the |
I probably won't be able to work on a PR for this.
I would rather leave the Something like |
There would be a separate edit: although...maybe Python's default rounding is good enough, and if somebody wants to round differently at nanosecond level, they should just use ints/floats 🤔 ...not worth adding a separate method indeed... |
I'm inclined to agree with this, but I haven't worked with anything nanosecond-precision so I can't comment on that. |
It would be useful to support floor division between
TimeDelta
s, like how it works withdatetime.timedelta
.TimeDelta
implements__truediv__
right now, but not__div__
.The text was updated successfully, but these errors were encountered: