Call a Python file with parameters

Terry Reedy tjreedy at
Tue Jun 10 18:23:44 CEST 2003

"W Isaac Carroll" <icarroll at> wrote in message
news:mailman.1055235859.10994.python-list at
> So you're trying to avoid the overhead of executing a def statement
> build the function? If the files have already been compiled by the
> you retrieve them from the database, the only thing that the import
> statement has to do is load the .pyc and bind the name. Were you
> assuming that the function would have to be executed twice (once to
> create it, once to call it)?

You can't execute a function before it is created ;-)  You do have to
execute a def statement to get a function object.  This occurs for
top-level def when the module is imported.  If a .pyc is saved (and
reused) then (I'm sure) the compiled body of the function is saved in
bytecode form, so that regenerating the function is rather quick.

Terry J. Reedy

More information about the Python-list mailing list