help on "from deen import *" vs. "import deen"

Steve D'Aprano steve+python at pearwood.info
Sat Nov 19 10:46:41 EST 2016


On Fri, 18 Nov 2016 03:14 pm, Michael Torrie wrote:

> On 11/17/2016 08:41 PM, jfong at ms4.hinet.net wrote:
>> The fact that most novices will stumble on Python variable many times
>> until it becomes his "second nature" proves it's different from the
>> human language:-)
> 
> The fact is that most novices don't stumble when dealing with Python
> variables. The nature of name binding vs memory boxes does trip up
> people occasionally, but most grasp it quickly and move on.
> 
> Since you are unwilling to prove your assertion or even provide a single
> example (you did once speak of couches and chairs but your reference
> made little sense), we can make no further progress.

I think you're being harsh on J Fong. And for what it is worth, I think that
I (slightly) agree with him: in my experience, many people have difficulty
understanding object model at first, especially if they've come from a
background of named memory boxes.

You should spend more time around beginners -- it is quite common for them
to be confused by name binding and all its consequences. I don't know if it
is "most novices", but I'm confident that it is quite common.

Coincidentally, on the Python tutor list, there was an example of this
earlier yesterday:

https://mail.python.org/pipermail/tutor/2016-November/110014.html

This is not just Python, of course, it includes most modern scripting
languages and some non-scripting languages. E.g. Lua, Javascript, Ruby and
Java (objects and boxed values, but not machine values). It's not that
Python is doing something weird compared to other languages. Python's name
binding semantics are very common.

They also have a lot in common with pointer semantics in C-like and
Algol-like languages: you have to reason through a level of indirection to
understand variables. And pointer semantics are notoriously difficult. So I
don't think it should be surprising that some people find it hard to
understand, at least at the beginning.





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list