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

> In my experience, when dealing with temporal data truncation (rounding 
> towards -infinity) is more useful than any other form of rounding. See also 
> issue 19475.

Ah, I agree - if you see that's how my __round__ implementation works. I guess 
that's another problem with the semantics of `round` (which are assumed to 
round to the nearest whole number). I suppose we could implement __floor__, but 
then you have the counter-intuitive property that in order to get access to 
this method, you have to import `math.floor`.

We could add a `datetime.truncate()` method, maybe, and not try to be clever 
about overloading existing operations. Or punt on the idea of truncation in 
general and do what I proposed in the original thread and have all the 
truncation happen in `now`.

----------

_______________________________________
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