On 2021-11-29 00:52, Christopher Barker wrote:
I will frequently do simple computation with literals to make my code
more clear:
t = 2 * 3600 # 2 hours in seconds
But I see no need to optimize this kind of thing -- it would never be in
a tight loop.
The suggestion was specifically about op
On Mon, Nov 29, 2021 at 10:11 AM Rob Cliffe via Python-Dev
wrote:
>
> I am slightly surprised that it seems to be *easier* to fold selected
> constant expressions than to have more generic code to fold them all.
> Or at least, all those that don't contain containers, such as
> 1 in [0,1,2]
T
On 11/28/2021 7:52 PM, Christopher Barker wrote:
I will frequently do simple computation with literals to make my code
more clear:
t = 2 * 3600 # 2 hours in seconds
That is optimized as you'd hope. Tested in 3.8:
>>> dis.dis("t = 2 * 3600")
1 0 LOAD_CONST 0 (7200)
I will frequently do simple computation with literals to make my code more
clear:
t = 2 * 3600 # 2 hours in seconds
But I see no need to optimize this kind of thing -- it would never be in a
tight loop.
-CHB
On Sun, Nov 28, 2021 at 3:06 PM Rob Cliffe via Python-Dev <
python-dev@python.org> wr
I am slightly surprised that it seems to be *easier* to fold selected
constant expressions than to have more generic code to fold them all.
Or at least, all those that don't contain containers, such as
1 in [0,1,2]
Rob Cliffe
On 28/11/2021 21:10, Eric V. Smith wrote:
On Nov 28, 2021, at 3:0
> On Nov 28, 2021, at 3:03 PM, Serhiy Storchaka wrote:
>
> 28.11.21 17:13, Skip Montanaro пише:
>>> That is not entirely true:
>>> https://github.com/python/cpython/pull/29639#issuecomment-974146979
>>
>> The only places I've seen "if 0:" or "if False:" in live code was for
>> debugging. Opti
27.11.21 15:47, Jeremiah Vivian пише:
> Many operations involving two literals are optimized (to a certain level). So
> it sort of surprises me that literal comparisons are not optimized and
> literal contains only convert the right operand to a constant if possible.
> I'd like to implement opti
28.11.21 17:13, Skip Montanaro пише:
>> That is not entirely true:
>> https://github.com/python/cpython/pull/29639#issuecomment-974146979
>
> The only places I've seen "if 0:" or "if False:" in live code was for
> debugging. Optimizing that hardly seems necessary. In any case, the
> original comm
Speaking as the author of the doc pages, I think I can safely say that
anyone who was smart enough to use asyncore/asychat back in the day (I used
it in "Python Web Programming") is almost certainly smart enough to have
migrated away from them long ago. They were an interesting approach to
asynchro
> That is not entirely true:
> https://github.com/python/cpython/pull/29639#issuecomment-974146979
The only places I've seen "if 0:" or "if False:" in live code was for
debugging. Optimizing that hardly seems necessary. In any case, the
original comment was about comparisons of two constants. I s
On 28/11/2021 6:28 am, raymond.hettin...@gmail.com wrote:
For the benefit of the audience on python-dev, you should also mention that
this proposal and associated PR has been twice discussed and rejected on the
tracker:
https://bugs.python.org/issue45907
https://bugs.python.org/issu
11 matches
Mail list logo