[Python-Dev] PEP 231, __findattr__()

Finn Bock bckfnn@worldonline.dk
Tue, 05 Dec 2000 15:40:10 GMT


On Tue, 05 Dec 2000 07:54:20 -0500, you wrote:

>>     GvR> What does Jython do here?
>> 
>> It's not exactly equivalent, because Jython's __findattr__ can't call
>> back into Python.
>
>I'd say that Jython's __findattr__ is an entirely different beast than
>what we have here.  Its min purpose in life appears to be to be a
>getattr equivalent that returns NULL instead of raising an exception
>when the attribute isn't found -- which is reasonable because from
>within Java, testing for null is much cheaper than checking for an
>exception, and you often need to look whether a given attribute exists
>do some default action if not. 

Correct. It is also the method to override when making a new builtin
type and it will be called on such a type subclass regardless of the
presence of any __getattr__ hook and __dict__ content. So I think it
have some of the properties which Barry wants.


regards,
finn