Reference or Value?

Christian Heimes lists at cheimes.de
Mon Feb 23 14:41:42 EST 2009


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.

Christian




More information about the Python-list mailing list