[Python-Dev] Class Methods

Dieter Maurer dieter at handshake.de
Tue Apr 24 16:43:14 EDT 2001


"Thomas Heller" <thomas.heller at ion-tof.com> writes on Mon, 23 Apr 2001 16:17:46 +0200:
> > > > What I want to avoid is
> > > >
> > > >   class X(...):
> > > >       ....
> > > >   initialize(X)
> > >
> > > Yes! We use this monstrosity a lot in Zope.
> > You know Guido's MetaClass article?
> >
> > I read it (did not understand it completely) and
> > I think, automatic initialization at the end of
> > class construction would be feasible.
> >
> 
> Of course it's possible. The problem is that normally
> metaclasses are implemented in C (it seems a python
> implementation is way to slow for most uses). On the
> other hand this is a lot of work, you have to completely
> duplicate the whole class/instance/method behaviour
> from standard python.
But I can use the functions that Python would use to build one of
its classes, just add an additional initialization call
after that....

Furthermore, speed seems not fundamental for meta classes.
When is a meta class used? To create a class.
One does not tend to do that too often....

Dieter



More information about the Python-list mailing list