simple metaclass question

Alex Martelli aleax at aleax.it
Wed Nov 13 07:42:42 EST 2002


Carl Banks wrote:
   ...
> 2. Because M is not a subclass of type, instances of M are not types.
>    Therefore, A is not a type.  (I'm not sure of this one, though.  I
>    think in Python an object can be a type only if it is a subclass of
>    type; I'm not sure if this is true in other languages with

I'm not exactly sure of what it is that you believe, but, for the record: 
objects CAN be types of other objects, in Python, without subclassing the 
built-in `type` -- for example:

>>> class oldClass: pass
...
>>> issubclass(type(oldClass), type)
0


Alex




More information about the Python-list mailing list