Re: [RFC] Draft Proposal for New Python Syntax
Sat, 28 May 1994 00:40:46 +0200

> > Steven Majewski might not agree with me, but in Python you are better
> > off using "for" loops (the overhead of calling a function for each
> > element is quite substantial).
> Due to stack pushes and pops? Or is a dictionary established for the
> parameters each time a function is invoked? Or is it something else?
> (This is useful practical information.)

There's a lot of overhead involved with calling a Python function --
have a look at the start (and end!) of the function eval_code() in
ceval.c. A Python stack frame is really quite a complicated beast,
even when local variables aren't stored in a dictionary. It involves
several C stack frames (call_object() -> call_function() ->
eval_code()) several new Python objects allocated on the heap (the
frame object, the argument list, the list containing local variables,
and the dictionary that might contain the local variables in some case
but which is always created; maybe more...)

--Guido van Rossum, CWI, Amsterdam <>
URL: <>