sudhanshu gautam wrote:
<snip>

Now If I placed the name of the constructor rather than the __init__
__baba___ so will it also work as a constructor or constructor has specified already if yes then give me list of them

I'm not sure I parsed your question as you intended, but __init__ is pretty much the constructor method ( with __new__ )

But I suspect you may be asking about that group know as magic methods, which you may want to look into. These include things like __getattr__, __len__, __gt__, and lots more. These make it easy to do things like:

>>> class Test:
...     def __init__(self):pass
...     def __gt__(self,other): return True
...
>>> t = Test()
>>> t>3
True
>>> t>0
True
>>> t>"hello"
True
>>>

And you may even find out why the following work as well...

>>> t<"hello"
True
>>> t <3
True
>>>


Regards,

Emile

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to