Comment 8 for bug 142399

Revision history for this message
Dieter Maurer (d.maurer) wrote :

The primary purpose of the proposed feature is to get a safe way to ask whether given object "o" truely has attribute "a" i.e. does not acquire it.
This implies the following semantics:

'hasattr_unacquired(o,a) == True if and only if "getattr(o, a) is obtained by looking at "o" only (and not at its acquisition context)'.

It means also, that "hasattr_unacquired(o, a)" should return "True", when "o" truely has "a" but the current user cannot
access "a". Should the user access such an attribute after the test, he will get an "Unauthorized".

One of my primary usage idioms looks like:

     if not hasattr_unacquired(o, id):
        # create child "id"
       ...
     child = getattr(o, id)