<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 11/08/16 16:36, Brandon Allbery wrote:<br>
<blockquote
cite="mid:CAKFCL4X8dt82uPRh6O3O-X2Keyieo-+SNcUKEv1_U55qm-KWHw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Aug 11, 2016 at 2:20 AM,
Lawrence Velázquez <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:larryv@macports.org"
target="_blank">larryv@macports.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Which is
unexpected to say the least. It's because "os" gets
hijacked as a variable name, around line 440:</blockquote>
</div>
<br>
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.<br>
</div>
</div>
</blockquote>
Where else would they go? How do you refer to a namespace except by
name (other than the default)?<br>
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 "print = 3" if you want (just as you can in, say, JavaScript
and Ruby, 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"
<a class="moz-txt-link-freetext" href="https://mail.python.org/pipermail/tutor/2003-October/025932.html">https://mail.python.org/pipermail/tutor/2003-October/025932.html</a> You
can change whatever you want however you want-- you just shouldn't.<br>
<br>
It's not too hard to deal with<br>
<br>
1) Look for the import statements in the file you're in (grep import
my.py)<br>
2) Don't use the imported names, or import them as something else,
e.g. "import os as _os"<br>
<br>
<br>
<br>
Russell<br>
</body>
</html>