Question about Pass-by-object-reference?

Steven D'Aprano steve at
Wed Jul 23 07:36:37 CEST 2014

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!"


More information about the Python-list mailing list