[issue32522] Add precision argument to datetime.now

Barry A. Warsaw report at bugs.python.org
Tue Jan 9 14:02:46 EST 2018


Barry A. Warsaw <barry at python.org> added the comment:

On Jan 9, 2018, at 08:33, Paul Ganssle <report at bugs.python.org> wrote:

> @Barry I don't think it's a good idea to duplicate the `replace` functionality in `datetime` like that. I think the main problem isn't the `.replace`, it's the fact that you have to specify exactly which components you want to set to zero - to get "the beginning of this month" or "today at midnight" or "the beginning of the current hour" or "the beginning of the current minute", you have to manually replace a whole list of these components.

I personally haven’t ever had to do anything but get rid of the microseconds field, so maybe my use case is too limited.  It’s a minor inconvenience and I don’t like having to throw away an intermediate datetime, so that’s the main thing I’d like to improve.  I’d also caution trying to get too fancy and complicated for use cases that are already supported or are rare.

----------

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


More information about the Python-bugs-list mailing list