As stated in a previous blog post, all data types in Python are objects. Objects are composed of methods and attributes. In Python these are accessed using dot ..


We print out the real part of the number since now num is now an object and has access to the methods for objects of type int.

num = 1
print(num.real) #1

If we create

mylist = [2,4]
mylist.append(6) #[2,4,6]

An important rule to understand is the memory address of a variable will change if you assign it a value that is different. If you use one of the variable’s built-in methods in order to modify it, then the memory address remains the same.