solving the metaclass conflict
Michele Simionato
mis6 at pitt.edu
Mon Jun 9 10:12:40 EDT 2003
pje at telecommunity.com (Phillip J. Eby) wrote in message news:<25b5433d.0306081024.517d855e at posting.google.com>...
> Under Python 2.2, you can't mix a new-style class with 'type' (and not
> cause Python to core-dump when you inspect the resulting class!). So
> if you want to create a mixin that can be used with 'type' as well as
> other kinds of classes, you *have* to use a classic class.
I misinterpreted you, you are saying that the *class* cannot be
inspected, not the metaclass. You are indeed right:
class N(object): pass
class M(N,type): pass
class C: __metaclass__=M
help(C) # core dump under Python 2.2
Fortunately, this is not the case for Python 2.3, therefore I don't
see the reason to support explicitely old style classes.
Cheers,
Michele
More information about the Python-list
mailing list