Following table lists some generic functionality that you can override in your own classes −
Sr.No. | Method, Description & Sample Call |
---|---|
1 | __init__ ( self [,args...] ) Constructor (with any optional arguments) Sample Call : obj = className(args) |
2 | __del__( self ) Destructor, deletes an object Sample Call : del obj |
3 | __repr__( self ) Evaluable string representation Sample Call : repr(obj) |
4 | __str__( self ) Printable string representation Sample Call : str(obj) |
5 | __cmp__ ( self, x ) Object comparison Sample Call : cmp(obj, x) |