Should proxy objects lie about their class name?

Carl Banks pavlovevidence at gmail.com
Tue Nov 27 00:56:16 CET 2007


On Nov 20, 3:50 pm, j... at pobox.com (John J. Lee) wrote:
> Not much to add to the subject line.  I mean something like this:
>
> ProxyClass.__name__ = ProxiedClass.__name__
>
> I've been told that this is common practice.  Is it?  Would this
> surprise you if you ran into it in a debugging session?
>
> One very real advantage that I can see is avoiding breaking existing
> doctests.
>
> Thanks in advance for your views


Python 3.0 has a proposal, accepted I believe, to allow classes to
control the behavior of issubclass and ininstance, so there appears to
be tacit support from the language for mimicking the proxied classes
in such ways.

I guess for me it would be a judgment call on based how tight I wanted
the proxy class to be--is it being the class, or is it just standing
in?


Carl Banks



More information about the Python-list mailing list