Bugs item #1204734, was opened at 2005-05-18 22:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1204734&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John Eikenberry (zhar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Documentation error?

Initial Comment:
>From http://www.python.org/dev/doc/devel/ref/new-style-attribute-access.html

"Called unconditionally to implement attribute accesses for instances of the 
class. If the class also defines __getattr__, it will never be called (unless 
called explicitly)."

But I'm not seeing this behaviour in python-2.3.5 and python-2.4.1 on Linux.

class A(object):

    def __getattr__(self,key):
        print '__getattr__',key
        raise AttributeError,key

    def __getattribute__(self,key):
        print '__getattribute__',key
        raise AttributeError,key

a = A()
a.foo

$ python test.py
__getattribute__ foo
__getattr__ foo
Traceback (most recent call last):
  File "test.py", line 14, in ?
    a.foo
  File "test.py", line 7, in __getattr__
    raise AttributeError(key)
AttributeError: foo

It seems to be calling __getattribute__ as it should, but then it falls back on 
__getattr__ even though the docs specifically say it shouldn't.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1204734&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to