New PEP: Attribute Access Handlers

Toby Dickenson mbel44 at dial.pipex.net
Tue Jul 25 07:20:58 EDT 2000


Paul Prescod <paul at prescod.net> wrote:

>http://python.sourceforge.net/peps/pep-0213.html
>
>PEP: 213
>Title: Attribute Access Handlers
>Version: $Revision: 1.3 $
>Owner: paul at prescod.net (Paul Prescod)
>Python-Version: 2.0
>Status: Incomplete

>Proposed Implementation

>    Property fetching
>
>        At the layer, Python instance attribute lookup is always done 
>        through PyInstance_getattr.
> 
>        A "get" proceeds as usual until just before the object is
>        returned.  In addition to the current check whether the returned
>        object is a method it would also check whether a returned object
>        is an access handler. If so, it would invoke the getter method
>        and return the value.

How does PyInstance_getattr know that an object "is an access handler"

I can see some cases where it would be appealing to implement a
property access handler in a C extension. Is it worth dedicating a
slot in PyTypeObject for these things?


Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list