On 11/8/2024 2:09 PM, dn via Python-list wrote:
On 8/11/24 14:40, Mild Shock via Python-list wrote:
Well you can use your Browser, since
JavaScript understand post and pre increment:
Question: are we talking Python or JavaScript?
So we have x ++ equals in Python:
Trying to find a word-for
On 8/11/24 14:40, Mild Shock via Python-list wrote:
Well you can use your Browser, since
JavaScript understand post and pre increment:
Question: are we talking Python or JavaScript?
So we have x ++ equals in Python:
Trying to find a word-for-word translation serves as badly in
computer-pr
Well you can use your Browser, since
JavaScript understand post and pre increment:
> x = 5
5
> x ++
5
> x = 5
5
> ++ x
6
So we have x ++ equals in Python:
x + = 1
x - 1
And ++ x equals in Python:
x += 1
x
But I don't know how to combine an
assignment and an expression into on
The wiked brain of ChatGPT gives me a lead:
PEP 659
Storing data caches before the bytecode.
Maybe its an effect of constant folding
and constant pooling by the compiler?
Mild Shock schrieb:
For example this article:
https://www.codementor.io/@arpitbhayani/python-caches-integers-16jih595jk
For example this article:
https://www.codementor.io/@arpitbhayani/python-caches-integers-16jih595jk
about the integer singletons claims:
>>> x, y = 257, 257
>>> id(x) == id(y)
False
But on Windows my recent CPython doesn't do that:
Python 3.14.0a1 (tags/v3.14.0a1:8cdaca8, Oct 15 2024, 20:08
Hi,
In Java its possible to work this way
with the Integer datatype, just call
Integer.valueOf().
I am not sure whether CPython does the
same. Because it shows me the same behaviour
for small integers that are more than
only in the range -128 to 128. You can try yourself:
Python 3.14.0a1 (tags
This only works for small integers. I guess
this is because tagged pointers are used
nowadays ? For large integers, also known
as bigint, it doesn't work:
Python 3.13.0a1 (tags/v3.13.0a1:ad056f0, Oct 13 2023, 09:51:17)
>>> x, y = 5, 4+1
>>> id(x) == id(y)
True
>>> x, y = 10**200, 10**199*10
>>
On 8/11/24 11:15, Greg Ewing via Python-list wrote:
On 8/11/24 3:04 am, Mild Shock wrote:
This only works for small integers. I guess
this is because tagged pointers are used
nowadays ?
No, it's because integers in a certain small range are cached. Not sure
what the actual range is nowadays,
On 8/11/24 3:04 am, Mild Shock wrote:
This only works for small integers. I guess
this is because tagged pointers are used
nowadays ?
No, it's because integers in a certain small range are cached. Not sure
what the actual range is nowadays, it used to be something like -5 to
256 I think.
BT