On 7/23/2014 1:36 AM, Steven D'Aprano wrote:
On Tue, 22 Jul 2014 20:27:15 -0400, Terry Reedy wrote:

When you call a function, Python binds function parameter names to
argument objects in the function's local namespace, the same as in name
assignments. Given

def f(a, b): pass

a call f(1, 'x') starts by executing

a, b = 1, 'x'

in the local namespace.  Nothing is being 'passed'.


If nothing is being passed, how does the function know to bind 1 and 'x'
to names a and b, rather than (say) this?

a, b = 23, 'Surprise!"

To quote your other message, "Magic happens, and a result is returned."

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to