[Python-Dev] PEP 231, __findattr__()
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Tue, 5 Dec 2000 00:19:37 +0100
> I'm not sure I understand what Moshe was proposing. Moshe: are you
> saying that we should change the way the compiler works, so that it
> somehow recognizes this special case? I'm not sure I like that
> approach. I think I want something more runtime-y, but I'm not sure
> why (maybe just because I'm more comfortable mucking about in the
> run-time than in the compiler).
I guess you are also uncomfortable with the problem that the
compile-time analysis cannot "see" through levels of indirection.
E.g. if findattr as
return self.compute_attribute(real_attribute)
then compile-time analysis could figure out to call compute_attribute
directly. However, that method may be implemented as
def compute_attribute(self,name):
return self.mapping[name]
where the access to mapping could not be detected statically.
Regards,
Martin