russell.jones at physics.ox.ac.uk
Thu Aug 11 09:09:26 PDT 2016
On 11/08/16 16:36, Brandon Allbery wrote:
> On Thu, Aug 11, 2016 at 2:20 AM, Lawrence Velázquez
> <larryv at macports.org <mailto:larryv at macports.org>> wrote:
> Which is unexpected to say the least. It's because "os" gets
> hijacked as a variable name, around line 440:
> Aaaaand I have another reason to dislike Python. *Why* are those in
> the same namespace?! You basically cannot trust code that might decide
> to reuse some part of module space as a local variable, and the
> resulting errors are inscrutable.
Where else would they go? How do you refer to a namespace except by name
(other than the default)?
I guess there could be some kind of protection of imports, but if you
get there aren't the error message is understandable. Note you can say
though Ruby appears to silently ignore it-- possibly that's a name
resolution thing). However, Python has a concept of "we're all
consenting adults here"
https://mail.python.org/pipermail/tutor/2003-October/025932.html You can
change whatever you want however you want-- you just shouldn't.
It's not too hard to deal with
1) Look for the import statements in the file you're in (grep import my.py)
2) Don't use the imported names, or import them as something else, e.g.
"import os as _os"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the macports-dev