[Python-Dev] Pre-PEP: Attribute Access Handlers v2

Barry A. Warsaw bwarsaw@beopen.com
Fri, 21 Jul 2000 20:16:37 -0400 (EDT)

>>>>> "FB" == Finn Bock <bckfnn@worldonline.dk> writes:

    FB> This way each computed attribute get controll when accessed,
    FB> modified and deleted. The hooks primary purpose is to support
    FB> JPythons use of java bean properties, fields and methods. It
    FB> is currently not available from within python, so it is not
    FB> possible to define "def _doget(..)" in a python class.

    FB> All this is just a datapoint.

But a good one, and perhaps one to model CPython on.  There are also
similarities here with the Zope Acquisition model, which uses __of__
instead.  So this is clearly a functionality that is very useful in
some contexts.

JPython's __findattr__ hook might also be useful because it allows
interposition on the lookup of all names, i.e. not just missing names.

In any event, we should look to JPython as an example of how it might
be done, but once a formal mechanism is adopted for CPython, we'll add
it to the language spec and update JPython to support the same