Class destructor : Class del : Class PYTHON examples


PYTHON examples » Class » Class del »

 

Class destructor


Class destructor: __del__


class Life:
     def __init__(self, name='unknown'):
         print 'Hello', name
         self.name = name
     def __del__(self):
         print 'Goodbye', self.name

brian = Life('Brian')

brian = 'loretta'

print "Before delete"

print brian

del brian

print "after delete"


           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class del