On 19 February 2018 at 17:11, Ned Batchelder <n...@nedbatchelder.com> wrote: > On 2/19/18 10:39 AM, Paul Moore wrote: >> >> I'm curious - How would you explain Python's "variables" to someone >> who knows how C variables work, in a way that ensures they don't carry >> across any unfortunate misconceptions based on how C works? If I had a >> good way of doing that, maybe I wouldn't need to play apple/orange >> games when discussing the subject. > > I would (and did) explain it like this: > https://nedbatchelder.com/text/names1.html > > That talk was pretty much powered by hating the phrase "Python has no > variables" :)
Interesting (and somewhat embarrassing :-() That talk (which I'd forgotten was yours) was one of the key things that made me start thinking in terms of Python naming values rather than assigning values to variables! I still find that your explanation (which never uses the term "variable" until you refer to the "Python has no variables" idea at the end) is one of the best ways to describe how Python assignment works. But using your explanation as a way to defend a statement that you don't agree with is wrong, so I'll stop doing that in future. Sorry! In terms of your talk, would I be right to say that "names" (in the sense you use them in that talk) are Python's "variables"? That equates to common usage, so I can go with that ("Python's variables act like names, unlike other languages"). But I'd hate to replace one misunderstanding of what you said with another, so let me know if I've still got it wrong... Paul -- https://mail.python.org/mailman/listinfo/python-list