[Python-3000] [Python-Dev] Betas today - I hope
Nick Coghlan
ncoghlan at gmail.com
Thu Jun 12 16:54:08 CEST 2008
Michael Foord wrote:
> Guido van Rossum wrote:
>> Whether they'll care about this issue of course depends on whether
>> they need overloaded operators and other special delegations to be
>> delegated transparently. We'll have to see how important this is.
>> New-style classes have been around and recommended for a long time --
>> why haven't people pushed for a proxy class before?
>
> It's only in Python 3 that old style classes are going away fully, so up
> until now you could at least use a classic class to do the proxying.
>
> I've written my own proxy classes before that look very similar to this,
> and there are other proxy classes around that do the same (I thought one
> was by Phillip J Eby but can't find a reference easily). The last one I
> wrote was to proxy CPython objects from IronPython via Python.NET...
>
> I would prefer it if the proxy class wrapped the return values of
> inplace operations.
Yeah, the latest version on the issue tracker does that, and allows
subclasses to define a return_inplace() method to alter the behaviour
(e.g. a weakref.proxy equivalent wouldn't want to wrap the return values
so that it can ensure there is always at least one strong reference to
the result of the operation).
Since you can also replace the .target attribute with a property to
affect how the target object is stored and accessed, it's a reasonably
flexible approach.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list