Roman Suzi wrote: > Well, now every attr access goes thru __getattr__-method, > so this could cause situations which give not so clear > diagnostics: > > ----------------------------------------------------------------- > > Python 2.2a3 (#1, Sep 26 2001, 22:42:46) > [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 > Type "help", "copyright", "credits" or "license" for more > information. HELP loaded. Readline loaded. History loaded. >>> > class A: ... def aa(self): ... print self ... >>> class B(A): > ... def __getattr__(self, x): ... print "getattr:", x ... > >>> b = B() >>> b.aa getattr: __repr__ Traceback (most recent > call last): > File "<stdin>", line 1, in ? > TypeError: object is not callable: None > ----------------------------------------------------------------- Hmm. If that last line you typed into the interp was, in fact, "b.aa()", then there's nothing new here. The "print" asked for __repr__ and got None. You'll get something very similar in any version of Python. If you really typed "b.aa", then something's really strange, because you didn't ask to call anything, yet B's __getattr__ was asked for "__repr__", not "aa". Since I doubt Guido has adopted VB's call-with-no-args-doesn't-need-parens, I bet you misquoted your session. - Gordon
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4