[New-bugs-announce] [issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

Or Toledano report at bugs.python.org
Sat Apr 18 05:37:15 EDT 2020


New submission from Or Toledano <ortoledano at protonmail.com>:

I propose the zero(time_unit) function, which replaces all time units with greater equal resolution than time_unit by 0.
E.g. 
>>> datetime.datetime(2020, 4, 18, 12, 27, 30, 500).zero("second")
datetime.datetime(2020, 4, 18, 12, 27)
I purpose it for the datetime, time classes.
I also added unit tests for the function in those classes.
GitHub PR:

----------
components: Library (Lib)
messages: 366696
nosy: Or Toledano, belopolsky, lemburg, p-ganssle
priority: normal
severity: normal
status: open
title: Add zero function to time, datetime, which acts as the use case of replace to limit resolution
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40316>
_______________________________________


More information about the New-bugs-announce mailing list