On Nov 3, 2008, at 12:00 PM, Aaron Brady wrote:

I think we can conclude that Python passes by reference, since a
function can modify objects that were passed in to it.

Then please write the Python equivalent of the "Swap" methods shown at <http://www.strout.net/info/coding/valref/> (or at <http://javadude.com/articles/passbyvalue.htm >, for that matter).

And no fair wrapping the two parameters up in an object or using tuple packing/unpacking -- the point is to demonstrate that you can change the two parameters themselves, not some object that contains them or return them a different order.

And by the way, if mutating an object a parameter refers to qualifies as pass by reference, then Java, VB.NET/REALbasic (in ByVal mode), and C/C++ all pass by reference too. That'll be quite a surprise to their compiler authors! (I should know, as I'm one of them.)

Best,
- Joe

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

Reply via email to