metaclass & __slots__

Aahz aahz at pythoncraft.com
Wed Jul 10 18:54:41 EDT 2002


In article <c2595393.0207050552.e5fd6b at posting.google.com>,
Holden Caulfield <phoebe_1 at att.net> wrote:
>
> 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.

Thing is, historically Python has not had a constructor, just an
initializer.  Now that we have new-style classes with constructors, it's
still necessary to bring forward idioms that worked with older versions
of Python.  It's possible that Python 3.0 might collapse this into a
single method, but you're the first person I've seen complaining.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list