Message416245
> Since you seem to be challenging the value of 999999999, my question to you is, why do you care what the refcount of 1 is?
Yesterday I was teaching Python, and we were speaking of integer immutability, names being "labels to objects" and so on, and I was showing the memory layout of all of this by hand on a whiteboard while "prooving" my drawings using an interpreter.
While doing so came a question like "So, many modules can use the object int(1)?" So I answered yes, told that I expected many reuse of 1, and went importing sys.getrefcount to show them.
And boom, it printed 1000000209 so I bugged for a few seconds, the value was obviously not the real refcount, and was also obviously bumped by a constant like 100000000, so I went inspecting why and found this commit.
I have nothing against keeping 999999999, but in the other hand it could surprise other people, maybe we should at least document it near sys.getrefcount. |
|
Date |
User |
Action |
Args |
2022-03-29 07:04:09 | mdk | set | recipients:
+ mdk, gvanrossum, vstinner, Mark.Shannon, eric.snow, miss-islington, brandtbucher |
2022-03-29 07:04:09 | mdk | set | messageid: <1648537449.69.0.771214976456.issue45953@roundup.psfhosted.org> |
2022-03-29 07:04:09 | mdk | link | issue45953 messages |
2022-03-29 07:04:09 | mdk | create | |
|