In article <mailman.9742.1399477705.18130.python-l...@python.org>, Jerry Hill <malaclyp...@gmail.com> wrote:
> thinking of python variables as having two parts -- names and values > -- really can help people who are struggling to learn the language. There's many levels of learning, and we see them all on this list. For people who are just learning programming, and are learning Python as their first language, we need to keep things simple. These are the people who are still struggling to understand basic concepts such as algorithms, loops, and the most fundamental data structures. For those people, talking about variables as a container to hold a value is the right level of abstraction. At some point, that model no longer fits reality well enough that it becomes a barrier to further learning. When I write: def mutate(x, y): x = 42 y[0] = 42 x = 4 y = [4] mutate(x, y) print x, y and run it, unless I really understand about name binding and argument passing, I'm going to be totally befuddled by the result. At that point, I need to unlearn something I thought I understood, and that's really hard (en.wikipedia.org/wiki/Principles_of_learning#Primacy). So, this leads us to the classic dilemma in teaching. If I simplify things at first, it's easier to learn initially, but I'm setting the student up for problems later. If I try to be 100% correct about everything initially, it's like drinking from a firehose. It's hard to say which is better. I do know that when I first learned F = M * A in high-school physics, we didn't worry about what happens if the M is moving very fast, or is very small, or if its quarks are spinning in the wrong direction. OK, so that takes care of newbies. There's another whole class of people who learn Python. These are the people who have been doing this for a long time. They already know several of C, C++, Java, Lisp, Javascript, Go, Fortran, Pascal, Forth, etc. For them, learning a new language is an entirely different process from the newbie. For them, it's just a matter of "Oh, yeah, Python does classes this way, and has that kind of scoping, and the standard library includes this bunch of data structures, and ints are really bignums, and this flavor of strings, and there's some funky whitespace thing going on". Those are the people who want to know about name binding up front. -- https://mail.python.org/mailman/listinfo/python-list