Re: Getting a module's code object

2011-08-25 Thread Arnaud Delobelle
On 25 August 2011 16:07, Peter Otten <__pete...@web.de> wrote: > Arnaud Delobelle wrote: > >> In Python 3, a function f's code object can be accessed via f.__code__. >> >> I'm interested in getting a module's code object, [...] > > Taken from pkgutil.py: > > def read_code(stream): >    # This helpe

Re: Getting a module's code object

2011-08-25 Thread Peter Otten
Arnaud Delobelle wrote: > In Python 3, a function f's code object can be accessed via f.__code__. > > I'm interested in getting a module's code object, i.e. the code that > is executed when the module is run. I don't think it's accessible via > the module object itself (although I would be glad