Julien Palard <julien+pyt...@palard.fr> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45953>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to