[Python-Dev] Re: __pycode__ extension

Fernando Perez fperez528 at yahoo.com
Tue Nov 16 20:38:52 CET 2004


Aahz wrote:

> On Tue, Nov 16, 2004, Stelios Xanthakis wrote:
>> 
>> I posted a message on c.l.p a couple of days ago about a
>> python patch which adds a member __pycde__ to functions and
>> classes. This member is a string which holds the python code of
>> the function/class. (It works in interactively defined code
>> and exec'd definitions)
>> 
>> Supposing that: I ported this to 2.4b2 and made it have zero overhead
>> when python runs in normal mode, is there any chance it would be
>> considered a candidate for inclusion in mainline python?
> 
> There is zero chance it'll go into 2.4.  There's a decent chance it'll
> go into 2.5, but if you get any pushback on the feature, be prepared to
> write up a full PEP.

Well, not necessarily pushback, but I'd like a clarification at least.  What
kind of memory overhead does this introduce?  If every function running around
is holding a full copy of all its source, is this overhead potentially
significant?  What happens with decorators, which modify functions but are not
explicit source-level transformations?

Since this is already fairly straightforward to implement via inspect, I'd like
to see a pretty strong justification for its real need before seeing it go in. 
It smells a bit of unnecessary bloat to me, but perhaps I'm missing something
obvious, so I'd be happy to be educated.

Regards,

f



More information about the Python-Dev mailing list