A question on modification of a list via a function invocation

Steve D'Aprano steve+python at pearwood.info
Thu Sep 7 13:22:40 EDT 2017


On Fri, 8 Sep 2017 02:24 am, Chris Angelico wrote:

> On Fri, Sep 8, 2017 at 1:30 AM, Steve D'Aprano
> <steve+python at pearwood.info> wrote:
>> On Fri, 8 Sep 2017 12:28 am, Chris Angelico wrote:
>>
>>> languages without mutable objects don't
>>> really care whether they're pass-by-X or pass-by-Y.
>>
>> Only if you don't care about efficiency.
>>
>> Believe me, the first time you pass a five gigabyte array to a function using
>> pass-by-value, on a machine with only six gigabytes of memory, you'll care.
[...]
> Right - but sharing (in whatever form) is a pure optimization, with no
> visible semantics.

Apart from the disk activity light on your PC, as it starts thrashing :-)



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list