En Mon, 28 Apr 2008 11:30:52 -0300, Calvin Spealman ironfroggy-+z4E91SeU6Qg+LkckTzjXg@public.gmane.org escribió:
I'll play my part here and toss out some ideas we
could use this for.
I'm not really advocating it, yet, but I'll say I am
+0. In either case,
if we did, here are some possible uses:
We could break up the code into multiple sections
and allow alternatives
for sections with different versions. Different
versions could be used
for a few different things, including different
optimization levels,
supporting multiple bytecode versions, or storing
both pre and post AST
transformations of the code.
Thanks for the examples! The idea was to allow storing such things, but I could not think of a concrete alternative example.
Meta-ish data like docstrings could be pulled out of
the code objects
and injected in non-optimized modes. This might also
include original
source for code, which could be helpful when you
change the source and
still-running code tracebacks and gives you invalid
lines.
Bookkeeping data could sit in some sections,
detailing things like call
stats (average call time, frequency, etc) and other
information that
could be useful for optimizers and JIT compilers
like psyco.
Do you mean, to update the file after the code is executed, to store such statistics? When would it be done?