py
py copied to clipboard
Update 16_class_and_objects.py
In code-1 ,The delete statement in the code deletes the id attribute of the emp object. The next try-except block tries to access the id attribute, which throws an error because it no longer exists. """[code-1]"""
Deleting the property of object
del emp.id
Deleting the object itself
try: print(emp.id) except NameError: print("emp.id is not defined")