opensubscriber
   Find in this group all groups
 
Unknown more information…

i : interface-dev@zope.org 5 December 2009 • 9:44PM -0500

Re: [Interface-dev] Odd metaclasses in Python 3
by Lennart Regebro

REPLY TO AUTHOR
 
REPLY TO GROUP




On Sat, Dec 5, 2009 at 12:56, Jim Fulton <jim@zope...> 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
_______________________________________________
Interface-dev mailing list
Interface-dev@zope...
https://mail.zope.org/mailman/listinfo/interface-dev

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.