Grumpy-pants spoil-sport

Antoon Pardon antoon.pardon at vub.be
Tue Sep 26 05:58:34 EDT 2017


Op 26-09-17 om 11:13 schreef Ben Finney:
> Steve D'Aprano <steve+python at pearwood.info> writes:
>
>> On Mon, 25 Sep 2017 10:53 pm, Ned Batchelder wrote:
>>
>>> Would we be able to end these interminable debates if we just agree
>>> that we all know how it works,
>> If only that were true. Not everyone understands Python semantics (or
>> for that matter, Java/Swift/language of your choice) and I still come
>> across people confused by the pass by value/reference false dichotomy
>> and which applies to <language of your choice>.
> Ditto. Many of my workmates still suffer from the misapprehension that
> “Python uses call-by-value semantics”, and many others suffer from the
> misapprehension “Python uses call-by-reference semantics”.
>
> No, we cannot just agree that we all know how it works. The well is
> poisoned for a long time, and we must diligently undo the conceptual
> damage for generations to come; and I know of no better way than
> continuing to publicly discuss how both misapprehensions are wrong.

That wont happen as long as people continue to do damage with e.g.
claiming that the python assignment is not an alias operation.

There is IMO no conceptual damage by regarding the call semantics
as call by reference. The swap problem people refer to is caused
by the assignment semantics and not because the parameter semantics
are substantially different from call by reference. For those who
think the swap problem is so important. I can write a swap function
for lists in python, so is it correct to conclude that list arguments
are passed by reference?

-- 
Antoon Pardon.





More information about the Python-list mailing list