is the order of the list of interfaces implemented by an object subject
to internal changes?

I have identified the need for such a pattern:

    iface = object.interface()


class someObject(object):
    implements(IMainInterface, ISecondaryInterface, ...)
    def interface():
        """Return the most specific interface implemented by the element."""
        return list(providedBy(self))[0]

to be able in that case to get access to the first interface implemented
by an object, as a sort of main object type.

the zope/app/component/registration.txt documentation mentions:

We can now write another `IComponentRegistration` implementation that knows
about the interface; in fact, it will pick the most specific one of the

  >>> from zope.interface import providedBy
  >>> class SomethingRegistration(Registration):
  ...     def interface(self):
  ...         return list(providedBy(self._component))[0]
  ...     interface = property(interface)


but I haven't seen it used anywhere else. Is it safe to use this?

regards /JM
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to