Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python

so basically its like this
//when object is created
a=A()
//this init is called
//similarly say
class A:
 def __len__(self):
     print("dd")
a=A()
len(a)
//prints dd basically python knows that magic method __len__ is to be called for len(a)
Source by wiki.python.org #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
6+1 =