Message378598
> "How long is it until Christmas?" the answer should be different if I ask on one minute past midnight on December 24 or one minute to midnight.
No disagreement there, but that doesn't change based on having the current precise time (the current implementation) vs the start of the current day (my recommendation), especially if you are just calculating the difference in days. In both cases, running it one minute before midnight would return the 23rd, running it one minute after would return the 24th.
The only difference between both is that a direct subtraction from the beginning of the day, with the current implementation, would result in one-point-something days, instead of one day. If that is the case, what is the point of having datetime.today? It should be, like the original issue suggested, phased out.
The benefit doesn't lie there, rather it lies in having direct access to date.today in a datetime format, so you can perform math on it with datetime objects. This, in my opinion, would be more consistent with other languages, and more importantly would make datetime.today logical, as it would be date.today in datetime form, instead of datetime.now.
> many (maybe a majority) of uses of datetime.today are conceptually better as date.today, but not all of them.
In what cases would having the current time be better? Should those cases instead use datetime.now for legibility? |
|
Date |
User |
Action |
Args |
2020-10-14 02:34:55 | HassanAbouelela | set | recipients:
+ HassanAbouelela, belopolsky, steven.daprano, p-ganssle, yurzo |
2020-10-14 02:34:55 | HassanAbouelela | set | messageid: <1602642895.04.0.736283117078.issue41904@roundup.psfhosted.org> |
2020-10-14 02:34:55 | HassanAbouelela | link | issue41904 messages |
2020-10-14 02:34:54 | HassanAbouelela | create | |
|