search

Home  >  Q&A  >  body text

What is the principle of python reference counting initialization?


# When a = 1, due to python's cache pool, it can be parsed, but b is a brand new object, why is the reference count 2?

给我你的怀抱给我你的怀抱2721 days ago722

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-06-12 09:24:25

    help(sys.getrefcount)
    

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-12 09:24:25

    Let’s talk briefly first, because sys.getrefcount(b) is also considered a reference

    reply
    0
  • Cancelreply