__getatr__ question
Janko Hauser
jhauser at ifm.uni-kiel.de
Wed Oct 3 16:01:24 EDT 2001
It's the order of evaluation, and that you change the instance
inplace.
If you change __getattr__ to
def __getattr__(self, a):
self.string = a
print 'self.string = %s' % self.string
return(self.nop)
This becomes obvious. The output of k.func1(k.func2(12)) looks then
self.string = func1
self.string = func2
k.func2(12)
k.func2()
Although I must admit, that I also expected that the argument of a
function call is also evaluated before the function is called.
So it does not seem to look like a bug, but perhaps there are more
insights available :-).
__Janko
--
Institut fuer Meereskunde phone: 49-431-597 3989
Dept. Theoretical Oceanography fax : 49-431-565876
Duesternbrooker Weg 20 email: jhauser at ifm.uni-kiel.de
24105 Kiel, Germany
More information about the Python-list
mailing list