This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author p-ganssle
Recipients barry, belopolsky, p-ganssle, tim.peters, vstinner
Date 2018-01-09.16:56:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515517008.73.0.467229070634.issue32522@psf.upfronthosting.co.za>
In-reply-to
Content
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)`).
History
Date User Action Args
2018-01-09 16:56:48p-gansslesetrecipients: + p-ganssle, tim.peters, barry, belopolsky, vstinner
2018-01-09 16:56:48p-gansslesetmessageid: <1515517008.73.0.467229070634.issue32522@psf.upfronthosting.co.za>
2018-01-09 16:56:48p-gansslelinkissue32522 messages
2018-01-09 16:56:48p-gansslecreate