Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

> I think that a "truncate to rrule" function is *way* beyond the scope of the 
> standard library

I agree and I did not propose that.  What I said was that in the process of 
implementing truncate to rrule in dateutil you may encounter some common 
pattern that may benefit from a new stdlib datetime feature.

The operation that I often need is

def truncate_datetime(t:datetime, interval:timedelta, start=datetime.min) -> 
datetime
    """Return the largest datetime of the form start + interval * i not greater 
than t"""

but it is exactly the kind of one-liner that does not belong to stdlib.

----------

_______________________________________
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