Sorry, I missed the fact that this was about nested classes. Still, I don't think it's worth fixing.
--Guido On 4/6/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > 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 <[EMAIL PROTECTED]> 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()) > >>> > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com