Код: Выделить всё
Python 3.13.0 (main, Oct 7 2024, 05:02:14) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getrefcount(None)
4294967295
>>> list_of_nones = [None for _ in range(100)]
>>> sys.getrefcount(None)
4294967295
>>> del list_of_nones
>>> sys.getrefcount(None)
4294967295
Код: Выделить всё
Python 3.10.15 (main, Sep 7 2024, 00:20:06) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>>
>>> sys.getrefcount(None)
4892
>>> list_of_nones = [None for _ in range(100)]
>>> sys.getrefcount(None)
4990
>>>
>>> del list_of_nones
>>>
>>> sys.getrefcount(None)
4890
Может кто-нибудь объяснить такое поведение?
Подробнее здесь: https://stackoverflow.com/questions/792 ... t-is-fixed