confusion about __getattr__
quinn at upchuck.ugcs.caltech.edu
Thu Jan 17 09:13:07 CET 2002
On Wed, 16 Jan 2002 21:47:37 -0500, Russ Cox <rsc at plan9.bell-labs.com> wrote:
>Could someone explain the error message in the
>following to me? I apologize if it should be
>obvious, but clearly I have the wrong mental
>picture of what's going on.
>Python 2.2+ (#0, Jan 16 2002, 19:28:19) [C] on unknown
>Type "help", "copyright", "credits" or "license" for more information.
>>>> class Test:
>... def __getattr__(self, name):
>... return '__getattr__ for '+name
>... def __init__(self):
>... self.foo = 'bar'
>... def asdf(self):
>... return 'jkl;'
>'__getattr__ for sdfsdfdsf'
>Traceback (most recent call last):
> File "<stdin>", line 1, in ?
>TypeError: 'str' object is not callable
>What is the str object in question that isn't callable?
More information about the Python-list