Possible Duplicate:
Python's use of __new__ and __init__ ?
The way I understand it, __init__
is different from a constructor in Java, because __init__
only initializes an object that has already been constructed implicitly (because __init__
is called after __new__
). However, everything that I have ever needed to define has used this latter property of a 'constructor' in Java. What would be a case in which a programmer would want to override __new__
?
EDIT: For the record, I ask partly because I'm wondering what would be the advantage/disadvantage to overriding new vs. using a separate classmethod in the accepted answer to this question: