Download our e-book of Introduction To Python
Balasaheb Garule
2 years ago
static int n = 30; #static memory management in python
#dynamic memory management in python
int * d;
d = new int;
def display():
str1 = “insideaiml” # ref count + 1
print(str1)
display()
# ref count -1
# insideaiml is out of scope
import sys
str1 = 'hello'
print(sys.getrefcount(str1))
4
text = "Welcome to insideAIML"
print(text)
Welcome to insideAIML
del(text)
print(text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'text' is not defined