[Python-Dev] Python Call Mechanism

Jeremy Hylton jeremy@alum.mit.edu
Wed, 1 Nov 2000 14:06:46 -0500 (EST)


My first impression is that this sounds like a nice simplifcation.

One question is how expensive this is for the common case.  Right now
arguments are pushed on the interpreter stack before CALL_FUNCTION is
executed, which is just a pointer assignment.  The pointers on the
stack are then assigned into the fast locals of the function after the
call.  Your scheme sounds like it would increase all function calls by
the cost of a tuple allocation.

It certainly wouldn't hurt to implement this, as it would provide some
practical implementation experience that would inform a PEP on the
subject.

On a related note, I have proposed a pep to add nested lexical scopes
for Python 2.1.  Barry's away for the moment, so it hasn't been
assigned a number yet.  It's just a proposal, not sure what Guido will
say in the end, but it also involves revising the function call
architecture.  I'll send a copy of the current draft (just notes)
under a separate subject.

Jeremy