[Python-3000] iostack and Oh Oh

tomer filiba tomerfiliba at gmail.com
Fri Dec 1 18:08:20 CET 2006

> I agree.  For instance, the
> [k] operation may be implemented by the Container interface generic
> implementation, in which case your type might have to have the
> Container interface

i would still like to understand how object proxying (e.g., weakrefs, RPyC),
could work when all/most frameworks/libraries would be based on ABCs.

again, the problem is, your proxy is an instance of ProxyType, that
refers to another, "concrete" object (e.g., getattr on the proxy performs a
getattr on the concrete object). but this only works with duck typing.

the concrete object may implement certain interfaces that ProxyType
does not/cannot implement (a la 3rd party). so despite the fact that the
proxy object *behaves* just like the concrete object, they are of different
types and ABCs. checking if the proxy implements an interface may
fail, although the proxy is sufficient for whatever purposes you wished
to use it.

the only way out of this, that i can think of, would require introducing a
__does_implement__ special method that will be called by
does_implement(), or whatever the name will be. of course you could
add a new ABC for that purpose, i.e., CustomImplementer.

that way, ProxyType will derive from CustomImplementer, and could
perform all the necessary magic inside, to look like the concrete object.

if custom proxies couldn't override the default implementation checking
mechanism (such as isinstance), i'm strongly against that.


More information about the Python-3000 mailing list