Paul Ganssle <p.gans...@gmail.com> added the comment:

I think if we're going to use `timedelta` then `__mod__` is the more 
appropriate option here, since it would be hard to interpret what `round(dt, 
timedelta(hours=2, microseconds=31))` would do.

Either __mod__ or __round__ with `timedelta` is a bit of a stretch in my 
opinion, and also is limited to well-defined units (and as such you can't round 
to the nearest month or year). I think a `round` taking either a string or an 
enum is the simplest, easiest to understand implementation (and/or adding a 
precision argument to `now` that is equivalent to `round(datetime.now(), 
precision)`).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to