On Mon, 10 Nov 2008 23:16:13 +1300, greg wrote: >> (CBV) An evaluation strategy where arguments are evaluated before >> the function or procedure is entered. Only the values of the >> arguments are passed and changes to the arguments within the called >> procedure have no effect on the actual arguments as seen by the >> caller. > > That hinges on what exactly is meant by "changes to the arguments". In > Python it can only mean assigning directly to the bare name -- anything > else isn't changing the argument itself, but something else to which the > argument refers.
But the name isn't the argument. The argument to a function is an object, not a name. You can't write a function in Python that takes a name as an argument[1], which would be equivalent to Pascal's "var" parameters. Take a function foo that takes one formal parameter x. Pass an actual argument y to it. The argument is the object currently bound to y, not the name y. Nothing inside foo can rebind the name y because foo doesn't see the name y, it sees the object. Rebinding (or deleting) the name x inside foo does nothing to the object bound to y, or the name y. [1] You can pass a string representing the name to a function, which can then use some combination of setattr, globals(), exec etc to work with the name represented by that string. But you're still passing an object to the function, not a name. -- Steven -- http://mail.python.org/mailman/listinfo/python-list