On 2021-06-24 09:19:36, Christopher Barker wrote:
No -- we're not assuming Python users are idiots -- there is an important difference here:
from extensions import flatten flatten(mylist)
very clearly adds the name `flatten` to the current module namespace. That itself can be confusing to total newbies, but yes, you can't get anywhere with Python without knowing that. Granted, you still need need to know what `flatten` is, and what it does some other way in any case. Whereas:
from extensions use flatten mylist.flatten()
does NOT import the name `flatten` into the local namespace -- which I suppose will be "clear" because it's using "use" rather than a regular import, but that might be subtle. But importantly, what it has done is add a name to some particular type -- what type? who knows?
This explicit namespacing is an important objection, IMHO. What about this syntax:
from extensions use flatten in list
And symmetrically:
from extensions use * in list
Going even further (maybe too far):
from extensions use * in *