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.
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.
2. Having different methods/decorators for implementer() on classes
and otherwise (ugly).
3. A "this_is_a_class_dammit" parameter to implementer() that uses
classImplements anyway (even uglier).
4. Something I haven't thought of yet.
I've temporarily decided on option 1, as it requires least work, only
updating the test_odd_declarations.py, which I now have done.