Reference or Value?

Denis Kasak denis.kasak at gmail.com
Mon Feb 23 14:58:42 EST 2009


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.

-- 
Denis Kasak



More information about the Python-list mailing list