On Sat, Dec 5, 2009 at 6:20 AM, Lennart Regebro <regebro@gmai...> wrote:
> In zope.interface for Python 3, we use the implementer() method as an
> implements() declaration. The idea was that it would be used both for
> methods and for classes. Turns out zope.formlib is already using it
> for instances as well, so it needs to work for instances, methods,
> functions and classes. This is not a problem because all we need to do
> is to check if something is a class or not. If it is we call
> classImplements, otherwise we just set __implements__.
> There are tests in zope.interfaces that are there to support
> ExtensionClasses. They test that you can implement things on a class
> who has a metaclass that doesn't subclass type. In Python 3, there
> seems to be no way to distinguish that kind of "odd" class from an
> instance. Simply, in Python 3, if you use a metaclass that is not a
> type, then you are not a class, but an instance. Hence, the above test
> fails, hence the Odd classes also fail.
> Possible solutions:
> 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.