Finding the instance reference of an object
Joe Strout
joe at strout.net
Mon Nov 3 15:44:15 EST 2008
More information about the Python-list mailing list
Mon Nov 3 15:44:15 EST 2008
- Previous message (by thread): Finding the instance reference of an object
- Next message (by thread): Finding the instance reference of an object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): Finding the instance reference of an object
- Next message (by thread): Finding the instance reference of an object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list