osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on modification of a list via a function invocation


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.