referans sayacı örneği 2
This commit is contained in:
parent
27ec2999c4
commit
f24438f86d
17
python-temel/referans.sayaci.2.py
Normal file
17
python-temel/referans.sayaci.2.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class Sample:
|
||||||
|
def __del__(self):
|
||||||
|
print('__del__ called')
|
||||||
|
|
||||||
|
a = Sample()
|
||||||
|
print(sys.getrefcount(a))
|
||||||
|
b = a
|
||||||
|
print(sys.getrefcount(a))
|
||||||
|
c = b
|
||||||
|
print(sys.getrefcount(a))
|
||||||
|
c = None
|
||||||
|
print(sys.getrefcount(a))
|
||||||
|
b = None
|
||||||
|
print(sys.getrefcount(a))
|
||||||
|
a = None
|
Loading…
Reference in New Issue
Block a user