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

2020-05-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I like the answer in the StackOverflow link better than this proposal. At any rate, I think Terry's suggestion is a good one. If you would like to move forward with this, please take it to python-ideas. That said, if another core-dev wants to

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

2020-04-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: I recommend posting this to python-ideas for discussion. -- nosy: +terry.reedy ___ Python tracker ___

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

2020-04-18 Thread Or Toledano
Or Toledano added the comment: The use-case for this method is to "limit" the resolution of a time object. I encountered the need for it when I needed to reduce the resolution of some timestamps, to compare them with timestamps of lesser resolution. I found the following SOF post:

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

2020-04-18 Thread SilentGhost
SilentGhost added the comment: What is the use-case for this new method? -- nosy: +SilentGhost ___ Python tracker ___ ___

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

2020-04-18 Thread Or Toledano
Or Toledano added the comment: https://github.com/python/cpython/pull/19580 -- ___ Python tracker ___ ___ Python-bugs-list mailing

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

2020-04-18 Thread Or Toledano
New submission from Or Toledano : 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

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

2020-04-18 Thread Or Toledano
Change by Or Toledano : -- keywords: +patch pull_requests: +18918 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19580 ___ Python tracker ___