Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Number of references to Python-6 test objects

Shulou Source: shulou.com Published: 2022-06-03 05:12:59 11月24日 Update

Import sys

Class T:

Pass

T = T

Num = sys.getrefcount (t)

The number-1 measured by print (num) # is the actual number of objects, where the value of num is 2, and the actual number of objects referenced is 1.

Tags: Number object actual test Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Linux Microsoft NVidia