Finding the instance reference of an object
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Mon Nov 3 19:27:31 EST 2008
On Mon, 03 Nov 2008 15:27:01 -0700, Joe Strout wrote:
> On Nov 3, 2008, at 2:36 PM, Aaron Brady wrote:
>> Python can do the swap operation on mutable types, for example.
>
> That's in the "no fair" category. C can do a swap operation on mutable
> types, too, though it also has only pass-by-value. Same for Java, or
> for REALbasic or VB.NET using "ByVal" mode. The fact that you can
> mutate mutable types has absolutely nothing to do with whether the
> parameter was passed by reference or value. If was by reference, you
> can change it (the parameter itself, not something the parameter may
> refer to). If it's by value, you can't.
>
> In Python, you can't. That's because parameters are passed by value.
This conclusion is flawed because call-by-value is not the only parameter
passing style with that characteristics.
>> By-Value and By-Reference are not the only passing methods. True or
>> False?
>
> True, but the others are rarely used and don't apply to any of the
> languages we've been discussing.
Maybe this is a surprise for you, because we haven't discussed this in
much detail in this group lately, but it applies to Python which does
call-by-object or call-by-sharing. ;-)
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list