Damian Yurzola <dam...@yurzola.net> added the comment:

It took me a while to collect my thoughts but here you go.

Advanced users don't have a problem. They'll trade in date or datetime objects 
explicitly. The "proof" is I could not find any github repo with more than one 
start that'll call datetime.today().

The less advanced users are sometime doing datetime.today and then all kinds of 
weird things.

HassanAbouelela has a good point: datetime.today() is a straight forward way to 
get today in a datetime object.


On the topic of:

> "How long is it until Christmas?"

# Current
In [7]: datetime.datetime.today() - datetime.datetime.now()
Out[7]: datetime.timedelta(days=-1, seconds=86399, microseconds=999991)

# Hassan's
In [16]: datetime.datetime(2020, 12, 25) - 
datetime.datetime(datetime.datetime.today().year, 
datetime.datetime.today().month, datetime.datetime.today().day)
Out[16]: datetime.timedelta(days=72)


Optimizing for the less advanced user, I believe Hassan's proposal yields the 
more intuitive result.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41904>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to