[Tutor] Printing the code of a function
motoom at xs4all.nl
Mon Dec 29 03:03:17 CET 2008
> I am wondering if there is a way to
> print out the code of a defined function.
When Python compiles source code, it doesn't store the source code
itself; only the compiled intermediate code. With the 'dis' package you
can disassemble that:
print "Show me the money."
2 0 LOAD_CONST 1 ('Show me the money.')
5 LOAD_CONST 0 (None)
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
More information about the Tutor