Once an object is created, you have full control over its properties (attributes). You can modify existing properties, add new properties on the fly, or even delete them altogether.
You can modify properties on objects like this:
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("John", 36)
// Set the age of p1 to 40
p1.age = 40
print(p1.age) # 40
You can delete properties on objects by using the del keyword.
# Delete the age property from the p1 object: del p1.age
You can also delete the object entirely by using the del keyword:
del p1
Which keyword is used to delete an object property in Python?