[EMAIL PROTECTED] wrote:
Would you like the source with your function?


Yes, since I asked for this feature something like two years ago ;-)

Well, the main objection seemed to be that we can get the source of a function one way or another. For functions with a file (1) with "inspect" , for functions defined dynamically with "exec"(2), by "knowing what we pass to exec and storing it", and for functions defined in the interactive prompt (3), by using a higher level IDE/shell that is not the pure raw_input, but does sophisticated analysis of code fed to it and which will be responsible for storing functions (!!). Still I believe it's the job of the core python parser to get this info and attach it to function objects.

The other problem was whether the source attribute should be saved to
pyc files (or more generally marhsaled together with the function
object).  Logically it should.  OTOH, for the application I had using
this, I didn't need marshalling source because it stored all the code
(initial functions + functions defined while the application was
running) in python source form.  So, I think that in practice one will
use either bytecode or the __source__ feature and not both, but I can't
prove it. 8)

There's a PEP and an --ugly- patch for 2.3.4

+10 ?


Stelios -- http://mail.python.org/mailman/listinfo/python-list

Reply via email to