Bruno Desthuilliers [EMAIL PROTECTED] ha scritto
nel messaggio news:[EMAIL PROTECTED]
Indeed. You explicitely raise, so the lookup stops here. You'd need to
explicitely call on superclass instead to have B.__getattr__ called, ie:
class A(object):
def __getattr__(self, name):
if
if this has a reason, if it is a design
choice or what else, any explanation is welcome.
No getattr is a lookup fallback, classes which implement them in a
non-collaborative way are unlikely to be used for multiple inheritance.
Given how multiple inheritance work and __getattr__ semantic, I was surprised
In article [EMAIL PROTECTED],
Bruno Desthuilliers [EMAIL PROTECTED] wrote:
Enrico a écrit :
Hi there,
I have the following situation (I tryed to minimize the code to concentrate
on the issue):
class A(object):
def __getattr__(self, name):
print 'A.__getattr__'
if name ==
Hi there,
I have the following situation (I tryed to minimize the code to concentrate
on the issue):
class A(object):
def __getattr__(self, name):
print 'A.__getattr__'
if name == 'a': return 1
raise AttributeError('%s not found in A' % name)
class B(object):
def __getattr__(self,
In article [EMAIL PROTECTED],
Enrico [EMAIL PROTECTED] wrote:
Hi there,
I have the following situation (I tryed to minimize the code to concentrate
on the issue):
class A(object):
def __getattr__(self, name):
print 'A.__getattr__'
if name == 'a': return 1
raise
Enrico a écrit :
Hi there,
I have the following situation (I tryed to minimize the code to concentrate
on the issue):
class A(object):
def __getattr__(self, name):
print 'A.__getattr__'
if name == 'a': return 1
raise AttributeError('%s not found in A' % name)
class B(object):
def