3 ms·
Python nested lists use pointers too; this is normal for high-level languages, as I explore in some depth in http://canonical.org/~kragen/memory-models/ http://
by kragen 7y ago
Python nested lists use pointers too; this is normal for high-level languages, as I explore in some depth in http://canonical.org/~kragen/memory-models/ http://canonical.org/~kragen/memory-models/. Look:
>>> x = [[3, 4], 5]
>>> y = [6, x[0]]
>>> y[1][1] = 7
>>> x
[[3, 7], 5]
Octave and Tcl are the exceptions here, and of course in Racket (and maybe in Clojure?) the pointer semantics aren't visible as they are above, but do affect performance.
I like Python a lot (I edited the Weekly Python-URL for a while) but it took me longer to switch to it --- most of 2000 and 2001, really. I still occasionally reach for perl for quick command-line things.