Guido van Rossum wrote: > I think it's fine as it is. I don't think making it walk the > inheritance tree is helpful; the output would be too large. Also, an > instance doesn't have any code and that's fine too. Inheritance has nothing to do with that. > (Didn't you mean "dis.dis(D) doesn't touch C"?) No. > On 4/6/06, Georg Brandl <g.brandl at gmx.net> wrote: >> Hi, >> >> dis.dis currently handles new-style classes stepmotherly: given >> >> class C(object): >> def Cm(): pass >> class D(object): >> def Dm(): pass >> >> dis.dis(C) doesn't touch D, and >> dis.dis(C()) doesn't touch anything. >> >> Should it be fixed? It may need some reworking in dis.dis. Here is an example transcript to make clearer what I mean: Python 2.4.2 (#1, Mar 12 2006, 00:14:41) >>> import dis >>> class C: ... def Cm(): pass ... class D: ... def Dm(): pass ... >>> dis.dis(C) Disassembly of Cm: 2 0 LOAD_CONST 0 (None) 3 RETURN_VALUE Disassembly of D: Disassembly of Dm: 4 0 LOAD_CONST 0 (None) 3 RETURN_VALUE >>> dis.dis(C()) Disassembly of Cm: 2 0 LOAD_CONST 0 (None) 3 RETURN_VALUE Disassembly of D: Disassembly of Dm: 4 0 LOAD_CONST 0 (None) 3 RETURN_VALUE >>> class Co(object): ... def Cm(): pass ... class Do(object): ... def Dm(): pass ... >>> dis.dis(Co) Disassembly of Cm: 2 0 LOAD_CONST 0 (None) 3 RETURN_VALUE >>> dis.dis(Co()) >>>
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