default values of function parameters

David Isaac aisaac0 at verizon.net
Sun Jun 5 23:20:53 EDT 2005


Alan Isaac wrote:
> Default parameter values are
> evaluated once when the function definition is
> executed. Where are they stored? ... Where is this documented?

Forgive any poor phrasing: I'm not a computer science type.
At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read:
"The execution of a function introduces a new symbol table
used for the local variables of the function. More precisely,
all variable assignments in a function store the value in the local
symbol table; whereas variable references first look in the local
symbol table, then in the global symbol table, and then in the table of
built-in names."

But the default values of function parameters seem rather like a static
attributes of a class.
Is that a good way to think of them?
If so, are they somehow accessible?
How? Under what name?

Thanks,
Alan Isaac






More information about the Python-list mailing list