[Tutor] repr()

Alan G alan.gauld at freenet.co.uk
Wed Jun 8 00:31:46 CEST 2005


> The real question is, then, is there a way I can print the code of a
> function as a string? Something like....
> 
> 'def myFunction: print "hello"'

There is a module for doing black magic like that. I think it may 
be the one with the disassembler in it?

Curious as to why you would ever want to though?

It may be there's another solution to whatever the problem is.

Alan G.


More information about the Tutor mailing list