[Interface-dev] Odd metaclasses in Python 3
Lennart Regebro
regebro at gmail.com
Sat Dec 5 08:44:15 EST 2009
On Sat, Dec 5, 2009 at 12:56, Jim Fulton <jim at zope.com> wrote:
>> 1. Dropping implementer() support for ExtensionClasses under Python 3.
>> This means that if you want to use ExtensionClasses under Python 3
>> (something which seems unlikely to happen anyway) you need to
>> explicitly use classImplements(Foo, IFoo) instead of
>> @implementer(IFoo). This seems reasonable to me.
>
> +1
That said, I *did* find a way to differentiate them. A class has
__bases__ even if it's from an "Odd" metaclass, while an instance has
not. So we can support ExtentionClasses under Python 3 by looking for
hasattr(ob, '__bases__')
instead of
isinstance(ob, type)
That's also a bit ugly, though.
--
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
More information about the Interface-dev
mailing list