[Paul Prescod on computed attributes] I'm not sure how well this is connected, but I would like to describe an existing feature of JPython that allow for computed attributes. The implementation of every python object have three methods (a little simplified): public PyObject _doget(PyObject container) { return this; } public boolean _doset(PyObject container, PyObject value) { return false; } public boolean _dodel(PyObject container) { return false; } As part of the implementation of __getattr__, the _doget method is always called: public PyObject __findattr__(String name) { ... PyObject ret = __class__.lookup(name, false); if (ret != null) return ret._doget(this); return null; } This way each computed attribute get controll when accessed, modified and deleted. The hooks primary purpose is to support JPythons use of java bean properties, fields and methods. It is currently not available from within python, so it is not possible to define "def _doget(..)" in a python class. All this is just a datapoint. regards, finn
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