❮ Previous Next ❯

Python Destructor


Python destructor is a function which is used to destroy the instance of a class.
It destroys all resources which are used by class instance.
A destructor is a class function that begins with double underscore (_). The name of the destructor is __del__().

Let’s see an example

#Python Destructor


class A:
def __init__(self):
print("Constructor Created")

def __del__(self):
print("destructor created")

def show(self):
print("Python means SILAN Technology")

obj=A()
obj.show()
obj.__del__()

Example:

python desctuctor
❮ Previous Next ❯

Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved