"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The names in the parameter list of the "def" statement are bound to
> the objects associated with the actual call. After that, they behave
> very much as locals... Now -- with defaults it gets a touch trickier...
A function's parameters are not just 'very much as locals', they *are*
locals.
>>> def f(x): print locals()
>>> f(3)
{'x': 3}
In particular, parameters are just those locals that are initialized in the
call process; it is an error for a parameter name to not become bound to
some object. The default objects fill in the slack when there are not
enough argument objects.
>From the calling side, the arguments are objects to be used in that initial
binding process, either directly or as part of a new collective object. It
is an error for an argument to not be used. The calling code does not care
about the parameter names, but just their number and nature.
So one can think of calling as cross-namespace name binding followed by
control transfer. Returning is similar except that return objects may
ignored or bound to slots rather than names.
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list