This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Paul.Davis, docs@python, dstanek, eric.araujo, terry.reedy
Date 2017-12-08.02:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512699168.88.0.213398074469.issue8722@psf.upfronthosting.co.za>
In-reply-to
Content
Cheryl, thank you for reviving this, as it is still needed.  A slightly revised example better illustrates the claim in the doc revision about when __getattr__ is called.

class Foo(object):

    def __init__(self):
        self.foo = 1
        self.data = {"bing": 4}

    def __getattr__(self, name):
        print(f'Getting {name}')
        return self.data.get(name)

    @property
    def bar(self):
        return 3

    @property
    def bing(self):
        raise AttributeError("blarg")

f = Foo()
print('foo', f.foo)
print('__str__', f.__str__)
print('bar', f.bar)
print('bing', f.bing)
f.__getattribute__('bing')

# prints
foo 1
__str__ <method-wrapper '__str__' of Foo object at 0x0000016712378128>
bar 3
Getting bing
bing 4
Traceback (most recent call last):
  File "F:\Python\a\tem2.py", line 24, in <module>
    f.__getattribute__('bing')
  File "F:\Python\a\tem2.py", line 17, in bing
    raise AttributeError("blarg")
AttributeError: blarg
History
Date User Action Args
2017-12-08 02:12:49terry.reedysetrecipients: + terry.reedy, dstanek, eric.araujo, docs@python, Paul.Davis
2017-12-08 02:12:48terry.reedysetmessageid: <1512699168.88.0.213398074469.issue8722@psf.upfronthosting.co.za>
2017-12-08 02:12:48terry.reedylinkissue8722 messages
2017-12-08 02:12:48terry.reedycreate