Albert-Jan Roskam wrote:

>> __getattr__() is only invoked as a fallback when the normal attribute
>> lookup fails:
> 
> 
> Aha.. and "normal attributes" live in self.__dict__?

I meant "normal (attribute lookup)" rather than "(normal attribute) lookup".
__getattr__() works the same (I think) when there is no __dict__: 

>>> class A(object):
...     __slots__ = ["foo"]
...     def __getattr__(self, name):
...             print "looking for", name
...             return 42
... 
>>> a = A()
>>> a.foo
looking for foo
42
>>> a.__dict__
looking for __dict__
42
>>> a.foo = "bar"
>>> a.foo
'bar'


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to