A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-December/010861.html below:

[Python-Dev] PEP 231, __findattr__()

[Python-Dev] PEP 231, __findattr__()Christian Tismer tismer@tismer.com
Sat, 02 Dec 2000 18:27:33 +0200
Hi Barry,

"Barry A. Warsaw" wrote:
> 
> I've just uploaded PEP 231, which describes a new hook in the instance
> access mechanism, called __findattr__() after a similar mechanism that
> exists in Jython (but is not exposed at the Python layer).
> 
> You can do all kinds of interesting things with __findattr__(),
> including implement the __of__() protocol of ExtensionClass, and thus
> implicit and explicit acquisitions, in pure Python.  You can also do
> Java Bean-like interfaces and C++-like access control.  The PEP
> contains sample implementations of all of these, although the latter
> isn't as clean as I'd like, due to other restrictions in Python.
> 
> My hope is that __findattr__() would eliminate most, if not all, the
> need for ExtensionClass, at least within the Zope and ZODB contexts.
> I haven't tried to implement Persistent using it though.

I have been using ExtensionClass for quite a long time, and
I have to say that you indeed eliminate most of its need
through this super-elegant idea. Congratulations!

Besides acquisition and persitency interception,
wrapping plain C objects and giving them Class-like behavior
while retaining fast access to internal properties but being
able to override methods by Python methods was my other use
of ExtensionClass. I assume this is the other "20%" part you
mention, which is much harder to achieve?
But that part also looks easier to implement now, by the support
of the __findattr__ method.

> Since it's a long PEP, I won't include it here.  You can read about it
> at this URL
> 
>     http://python.sourceforge.net/peps/pep-0231.html

Great. I had to read it twice, but it was fun.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4