1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python: getrefcount for integer returns memory address

Discussão em 'Python' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    I do not get the behavior of getrefcount in Python for an integer value.

    >>> import sys
    >>> sys.getrefcount(1)
    4294967295


    The return value looks more like a memory address to me. Searching StackOverflow, I've seen examples like this Why does sys.getrefcount give huge values?

    But I do get different return values

    >>> a = 10
    >>> getrefcount(a)
    4294967295


    This is Python 3.13.7 on MacOS 15.6.1

    Thanks for any hints. If there were changes in behavior of getrefcount, I'd appreciate a link.

    Continue reading...

Compartilhe esta Página