Reference or Value?

Steve Holden steve at holdenweb.com
Mon Feb 23 15:12:05 EST 2009


Denis Kasak wrote:
> On Mon, Feb 23, 2009 at 8:41 PM, Christian Heimes <lists at cheimes.de> wrote:
>> Denis Kasak wrote
>>> You could, however, argue that the swap function doesn't work as
>>> expected (e.g. from a Pascal or a C++ POV) simply because the
>>> underlying objects aren't mutable. The objects *do* get passed by
>>> reference;
>> We are getting down the same road every couple of months. Please don't
>> explain Python's calling system with terms like "call by reference".
>> It's plain simple wrong. The correct term is "call by sharing" or "call
>> by object reference" although I myself don't use the latter term because
>> it sounds too much like "call by reference". Every time somebody tries
>> to explain Python with "call by reference", the person is confusing
>> himself and others.
> 
> I assure you I am not confused about Python's object model / calling
> system. I was arguing, from a purely theoretical standpoint, that the
> same system Python uses could be described in terms of
> call-by-reference with some additional constraints. I am by no means
> arguing that this is a good way of explaining it or trying to explain
> it to someone in terms of call-by-reference. I just don't think it's
> "plain simple wrong", just confusing and suboptimal.
> 
Well, what's the benefit of discussing such a description, then?
Regulars on c.l.py see this subject arising so regularly it's a bit like
"there's nothing new under the sun". Honestly, it's been discussed /ad
nauseam/ lately.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list