Hacker News new | past | comments | ask | show | jobs | submit login

This reminds me of the "copy list" expression in Python:

    In [1]: a = [1, 2, 3]
    In [2]: b = a
    In [3]: a is b
    Out[3]: True
    In [4]: b = a[:]
    In [5]: a is b
    Out[5]: False
Usually this kind of "optimization" is done to avoid copying large ammounts of data in memory, but as you said, unless it's widesepread knowledge or explicitly stated, it can lead to some confusing situations/bugs.



In almost all cases knowledge of copy-on-write doesn't have to be widespread because it is equivalent to value semantics.

It is only because they were using a buggy dll (which for non-matlab users, is custom native code that matlab calls against using a FFI), that the expected semantics of matlab were violated.


That's just how Python works though, not an optimization. Python has names for objects more than it has variables, = binds a name to an object.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: