simple metaclass question

Carl Banks imbosol at vt.edu
Wed Nov 13 14:01:05 EST 2002


Alex Martelli wrote:
> 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:

Thanks.  I was thinking at the C level, where objects that serve as
types have to have a certain fixed structure.  To create a metatype in
Python (not C), it would have to be an instance of a class that
subtypes type, right?

Gawd, it takes a lot to spin my head in circles, but this metaclass
stuff is doing it.


-- 
CARL BANKS



More information about the Python-list mailing list