im confused with __call__() method defined within the class. __init__() is used as constructor, and is called when we create an instance of the object.
when does __call__() method get called even though we not specify it explicitly...
There are several internal functions like __init__() and __call__() that a class calls on it's own. The __call__() function is simply used to call on a callable object like the callback() function outside the class. In Tkinter the command=callback statement can not pass function arguments, so instantiating class Curry will do it. Just a trick to get around the limitations of Tkinter.
Animals is always fun to make with oop design in mind.
Here you se __call___ used like this cow('gras')
This fill the the empty list(stomach)
def __init__(self, name, legs):
self.name = name
self.legs = legs
self.stomach = 
if len(self.stomach) > 0:
return 'A animal named %s' % (self.name)
cow = Animal('king', 4) #We make a cow
dog = Animal('flopp', 4) #We can make many animals
print 'We have 2 animales a cow name %s and dog named %s,both have %s legs' % (cow.name, dog.name, cow.legs)
print cow #here __str__ metod work
#We give food to cow
#We give food to dog
#What comes inn most come out
print cow.stomach #Empty stomach
We have 2 animales a cow name king and dog named flopp,both have 4 legs
A animal named king