Usage of the init() method

Hi,

I am thinking about the init(…) method and the relation to subclassing in the Python wrapper. Today I have exposed this init method n the special classes for Python subclassing, but I am not sure they are really needed. In Python there is a __init__(…) method that is called after class creation, and that is the standard way to do it in Python. For the subclassing that I’ve practically done so far I have not experienced that I need to use the (java) init() method, but used the Pythonic version instead.

My question is, is the Java init() method used in any other way than at object creation? For example when resetting something, restarting something etc? Or is there some magic happening after the init() method and until the class is finalized?

If not I do not see the need to expose this in the Pythonic subclasses?

Or do you see some other aspect that should be taken into consideration?

Regards
/petrus

For the init(...) methods in step handlers and event handlers it probably makes sense to expose them in Python. These init methods are not called when the object is created, instead they are called when propagation starts. This allows a stateful event/step handler to be reused for multiple propagations.

Based on my limited understanding of Python the __init__(...) method is more similar to a Java constructor than the Java init(...) method.

Hi Evan,

Thanks for the input, yes that was what I was fishing for. Yes the __init__ in python is more a constructor called after object creation. The python __init__ will thus not be called if used as you mention and we should keep all possibilities in case needed for prototyping etc.

Thanks.