On 2019-11-14 20:29:01 -0500, Dennis Lee Bieber wrote: > Instead, at a simple level (a common description invokes "Post-It" > notes) > > x = y > > means /find/ the object (somewhere in memory) that has a note "y" stuck to > it. Without moving the "y" note, attach an "x" note to that same object. > The object now has two names bound to it. If the "x" note used to be > attached to an object, the old object no longer has that name -- and if the > object has NO names attached, it is garbage collected.
Frankly, I find that model very unsatisfying. It's not just that it doesn't describe any existing or even plausibly possible implementation or that it implies a complexity that isn't there (search for an object with a note attached to it?). It starts to break down even for simple cases: There may be several variables called "x" in a program. How does the system distinguish between multiple objects with an "x" note? What about objects which have no name, like members of a tuple or the return value of a function? Sure, you can come up with arcane rules to on how to label a post-it to reference an object referenced by the x parameter of the lamba on line 7 of the third recursive invocation of function foo within the method bar of the Gazonk class in the fred packagerbut called from Bobble ... (ok, I'll stop now). But why would you? It's much simpler to talk about references or pointers or whatever you want to call them. You can nicely visualize them with arrows (or pieces of string, if you want, but arrows have the advantage of having a direction) and it describes directly and without any mental gymnastics what is going on (on a conceptual level - actual implementations might be somewhat different, as long as they behave the same). hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | h...@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list