On Sat, 19 Nov 2016 05:50 am, Dennis Lee Bieber wrote: > Python's name binding is very easy to state in English: Assignment in > Python attaches the name (on the left hand side of the statement) to the > object (that is the result of the right hand side).
What do you mean "attach"? What's a name? What's an object? What happens if you do this? spam = eggs = cheese = obj Is that different from: spam = obj eggs = obj cheese = obj or from this? spam = obj eggs = spam cheese = eggs As an expert Python program with more than a decade's experience, you probably think these questions are so basic that they are obvious. But to a beginner, they aren't even close to obvious. https://www.edutopia.org/blog/the-curse-of-knowledge-chris-reddy https://signalvnoise.com/posts/213-the-curse-of-knowledge > In contrast, assignment in C, FORTRAN, BASIC, COBOL can be stated as: > Assignment in <language> copies the contents (value) of the memory > location identified by the right hand side to the memory location > identified by the left hand side. Well that doesn't help... foo = 999 + 1; What memory location is identified by the right hand side? > The Python actually comes out cleaner -- no need to explain memory > locations, contents/values, and copying. No, but you do have to explain "bind", "name" and "value". > If you need a visual, in Python, fully qualified names are labels with > a string; the other end of the string is taped to an object. Analogies are great, but you also have to explain the limits of the analogy. And analogies can mislead too. What's the first end attached to? What precisely is a name? Since we can do this: # name with string attached to object fred-------999 and we can do this: # two names with two strings both attached to the same object fred--------------999 | george-------------+ can we do any of these? If we can't, why not? # object with string not attached to any name -----------999 # name with string not attached to any object fred----------- # name with string attached to another name, attached to object fred---------george----------999 # object with string attached to name fred----------999-----------george # two names, attached to each other, with no object fred--------+ | george------+ # name with two pieces of string attached to two objects fred-----------------999 | +---------888 # name with string attached to another string? fred---------+ | george-------+------999 # two objects tied together 999---------888 # name with no string fred # object with no string 999 # string tied in a loop (with or without a name) fred+-----------+ | | +-----------+ +-----------+ | | +-----------+ These aren't silly questions. Some of them are meaningful, some of them aren't. They're questions suggested by the "label with string tied to an object" model of name binding. As experts, we're so used to the limits of the model that we don't stop to think about all the ways that it can mislead. But a beginner doesn't know the limits of the model, and doesn't know how to apply the model to their code. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list