As of version 0.9.3, PyProtocols supports the simplified adaptation API that
was pioneered by Twisted, and later adopted by Zope. In this simplified API,
a protocol can be called, passing in the object to be adapted. So, for example,
instead of calling
adapt(foo,IBar), one may call
optional default arguments can also be supplied, following the
All of the protocol types supplied by PyProtocols now support this simpler calling scheme, except for AbstractBase subclasses, because calling an AbstractBase subclass should create an instance of that subclass, not attempt to adapt an arbitrary object.
Notice, by the way, that you should only use this simplified API if you know for certain that the protocol supports it. For example, it's safe to invoke a known, constant interface object in this way. But if you're writing code that may receive a protocol object as a parameter or via another object, you should use adapt() instead, because you may receive a protocol object that does not support this shortcut API.