Hi,

may anybody tell me why there is a init AND a new-method? Why not using one constructor-method like we have to use in java and other OO-lanuages?? Would be nice if somebody can give me an idea about that. Thanks a lot

Jonny

I think it maintains the traditional distinction between allocation and initialization. When you use structures in C for example, you must first use malloc to allocate a structure and then you initialize the structure's content. These are 2 different kinds of operations. For example you can decide to change your allocation strategy (implementing a garbage collector or a memory pool or whatever) an this doesn't interfere with the fields intitialization. In C++, you can override the new operator for such things. Other OO languages like objective C separate allocation and initialization. So, in python, __new__ is for allocation and __init__ for initialization.
You could say that allocation deals with memory and initialization deals with your program's logic.

Oh okay. I did not know that other languages do so either, but you example with the c-structures sounds good. Thank you :)

Jonny