On 2023-01-10 22:21, Jen Kris via Python-list wrote:
There are cases where NumPy would be the best choice, but that wasn’t the case 
here with what the loop was doing.

To sum up what I learned from this post, where one object derives from another object (a = b[0], 
for example), any operation that would alter one will alter the other.  When either is assigned to 
something else, then they no longer point to the same memory location and they’re once again 
independent.   I hope the word "derives" sidesteps the semantic issue of whether they are 
"equal."

[snip]
In C terms (and in CPython), a 'list' is a resizable array of pointers to objects, so after "a=b[0]", the name "a" will point to the same object that b[0] points to. That object might or might not be mutable.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to