Reference counting and del

Introduction

"del"

Second "print()" fails because we have released the variable.


x = 1000
print(x)
del x
print(x)

Reference counting in Python

Reference count on each object.

References tracked automatically.

If references hits \(0\), object is automatically deleted.