[issue41904] datetime.datetime.today makes no sense and should be removed

Damian Yurzola report at bugs.python.org
Tue Oct 13 20:45:55 EDT 2020


Damian Yurzola <damian at yurzola.net> added the comment:

I searched all of github and there seem to be ~350K entries for datetime.today
I think this supports steven.daprano point against removal.

I could not spot any major library in a quick cursory look.

However I do see many calls that look a lot like they should have been

datetime.date.today rather than datetime.datetime.today.

You see people basically dropping the hours, minutes, secs.

And you also see people doing date math on datetime.date.today which will result in different answers through out the day.

I like HassanAbouelela's idea that datetime.datetime.today should return   an arbitrary fixed time rather than an arbitrary variable time.

----------

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


More information about the Python-bugs-list mailing list