by dr_zoidberg · 11y ago · 0 comments
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.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.