[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why do we nned both - __init__() and __new__()

dieter wrote:
> In the general case, constructing an object can be split into two
> subtasks: obtain a raw piece of storage able to manage the object's state;
> initialize the object's state. The first subtask is handled by "__new__",
> the second by "__init__".

Except that's not quite correct, because the cases where
you need to override __new__ are ones where it does *more*
than just allocate storage.