<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
wormwood_3 wrote:
<blockquote cite="mid:749311.18420.qm@web110812.mail.gq1.yahoo.com"
 type="cite">
  <style type="text/css"><!-- DIV {margin:0px;} --></style>
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hello
all,<br>
  <br>
This might be trivially easy, but I was having a hard time searching on
it since all the component terms are overloaded:-) I am wondering if
there is a way to print out the code of a defined function. </div>
</blockquote>
<br>
Python does not store the source when compiling things. So the short
answer is NO.<br>
<br>
There are some "disassemblers" for Python but I have no experience with
them. They will not be able to reconstruct the exact source.<br>
<br>
But ... why do you want to do this? Perhaps if we had more information
about the "use case" we could steer you to a solution.<br>
<br>
<blockquote cite="mid:749311.18420.qm@web110812.mail.gq1.yahoo.com"
 type="cite">
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;">So
if I have:<br>
  <br>
def foo():<br>
&nbsp;&nbsp;&nbsp; print "Show me the money."<br>
  <br>
then I would like to do something like:<br>
  <br>
&gt;&gt;&gt; foo.show_code<br>
def foo():<br>
&nbsp;&nbsp;&nbsp; print "Show me the money."<br>
  <br>
I checked out everything in dir(foo), but everything that looked
promising (namely foo.func_code), didn't end up being anything close.<br>
  <br>
Thanks for any help!<br>
  <br>
Cordially,<br>
Sam<br>
  <div>&nbsp;</div>
_______________________<br>
Samuel Huckins<br>
  <br>
  <div>Homepage - <a class="moz-txt-link-freetext" href="http://samuelhuckins.com">http://samuelhuckins.com</a><br>
Tech blog - <a class="moz-txt-link-freetext" href="http://dancingpenguinsoflight.com/">http://dancingpenguinsoflight.com/</a><br>
Photos - <a class="moz-txt-link-freetext" href="http://www.flickr.com/photos/samuelhuckins/">http://www.flickr.com/photos/samuelhuckins/</a><br>
AIM - samushack | Gtalk - samushack | Skype - shuckins
  <div><br>
  </div>
  </div>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Bob Gailer
Chapel Hill NC 
919-636-4239</pre>
</body>
</html>