__init__() not called automatically

2005-05-25 Thread Sriek
hi,
i come from a c++ background. i ws happy to find myself on quite
familiar grounds with Python. But, what surprised me was the fact that
the __init__(), which is said to be the equivlent of the constructor in
c++, is not automatically called. I'm sure there must be ample reason
for this. I would like to know why this is so? This is my view is more
burden on the programmer.
Similarly, why do we have to explicitly use the 'self' keyword
everytime?

Every kind of help would be welcome.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__() not called automatically

2005-05-25 Thread Sriek
Tim pointed out  rightly that i missed out the most crucial part of my
question.
i should have said that __init__() is not called automatically only for
the inheritance hierarchy. we must explicitly call all the base class
__init__() fuctions explicitly.
 i wanted a reason for that.
Thanks Tim.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__() not called automatically

2005-05-26 Thread Sriek
if i understand C++ right, in c++ you CAN explicitly call the base
constructor ( for eg. if it requires some particular arguements ), but,
the compiler automatically has to call the base class constructor ( see
the rules for constructing an object of the derived classes ).

But, yes, C++ can be too disgusting sometimes. But, i like the C++
design philosophy ( read D & E of C++ ? ), the rasons for various
features are intellgently put inplace.

Correct me if i am wrong about both the paragraphs. ok? T
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __init__() not called automatically

2005-05-26 Thread Sriek
maybe like this:
 we can have the default behaviour as calling the default constructor
( with default arguements where required ). Along with this, keep the
option open to call constructors explicitly.

My only contention is that there may be a greater reason for this rule
in the Python Language. thats it.

-- 
http://mail.python.org/mailman/listinfo/python-list