metaclass & __slots__

Thomas Heller theller at python.net
Fri Jul 5 10:05:32 EDT 2002


"Holden Caulfield" <phoebe_1 at att.net> wrote in message news:c2595393.0207050552.e5fd6b at posting.google.com...
> Alex & John,
>  Thanks for good explanations and clarifications. This was just an
> exercise to hurt my brain, I guess :)
>  But somehow I feel the addition of the "new" style classes and the
> "automatic" call of "__new__" and "__init__" is really confusing. The
> "__init__" seems redundant, since we actually have a true
> "constructor". I guess, what I am trying to say is, with the scarce
> documentation (and if you are lazy to browse through the source) it
> seems like you need to know the distinction on what to override
> (__new__ or __init__) for a class derived from a builtin.
>
There is quite some information about __new__ and __init__:

http://www.python.org/2.2.1/descrintro.html#__new__

Thomas





More information about the Python-list mailing list