metaclasses -- aka Don Beaudry hook/hack (was RE: Why should i use python if i can use java)
Thomas Heller
thomas.heller at ion-tof.com
Tue Jun 12 03:43:05 EDT 2001
More information about the Python-list mailing list
Tue Jun 12 03:43:05 EDT 2001
- Previous message (by thread): metaclasses -- aka Don Beaudry hook/hack
- Next message (by thread): metaclasses -- aka Don Beaudry hook/hack (was RE: Why should i use python if i can use java)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<James_Althoff at i2.com> wrote in message news:mailman.992305397.17770.python-list at python.org... > > Before I head too deeply into Zope dependencies, I would be interested in > knowing whether or not "type(MyClass) == types.ClassType" and > "isinstance(myInstance,MyClass)" work for classes derived from > ExtensionClass. (And if so, why do these work for C extension classes > using the Don Beaudry hook but not for Python classes using the same hook?) Actually there are two different hooks (lets call them the "Don Beaudry hook" and maybe "Guido's hook". Don Beaudry's hook calls the type of the base object if it is callable. Guido's hook calls the __class__ attribute of the base object if it is callable. See the source in Python/ceval.c for details. type(MyClass) == types.ClassType is false for ExtensionClass.Base derived classes, but isinstance() works (at least in Python 2.0, I'm not sure for 1.5.2). BTW: There are no further 'Zope dependencies' except for ExtensionClass itself. Thomas
- Previous message (by thread): metaclasses -- aka Don Beaudry hook/hack
- Next message (by thread): metaclasses -- aka Don Beaudry hook/hack (was RE: Why should i use python if i can use java)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list