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

2020-10-13 Thread Hassan Abouelela


Hassan Abouelela  added the comment:

> "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?

--

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



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

2020-10-13 Thread Hassan Abouelela


Hassan Abouelela  added the comment:

If having an arbitrary time returned from the function is an issue, why not use 
a fixed time, say 0 UTC, representing the start of the day. This would mean 
that datetime.today is date.today, with an (arguably) meaningless timestamp to 
make it a datetime object.

--
nosy: +HassanAbouelela

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



[issue25567] shlex.quote doesn't work on bytestrings

2020-10-11 Thread Hassan Abouelela


Change by Hassan Abouelela :


--
nosy: +HassanAbouelela
nosy_count: 9.0 -> 10.0
pull_requests: +21634
pull_request: https://github.com/python/cpython/pull/22657

___
Python tracker 
<https://bugs.python.org/issue25567>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com