<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">I avoid __all__ like the plague. Too easy for it to get out of sync with the API when i forget to add a new symbol. </span></blockquote><div><br></div><div>Your API should be one of the most stable parts of your code, no? </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 4:29 PM, Chris Barker <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Mar 16, 2016 at 6:52 PM, Rick Johnson <span dir="ltr"><<a href="mailto:rantingrickjohnson@gmail.com" target="_blank">rantingrickjohnson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:'courier new',monospace"><span>> Besides, why is "import x as _x" so special to require special syntax? <br></span></span></div></blockquote><div><br></div></span><div>It's not :-) I know I do, for instance,</div><div><br></div><div>from matplotlib import pylot as plt</div><div><br></div><div>But have NEVER done the leading underscore thing...</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:'courier new',monospace"> from module import Foo as _Foo, bar as _bar, BAZ as _BAZ, spam as _spam, eggs as _eggs<br></span></div></blockquote><div><br></div></span><div>if you are mirroring an entire namespace, or a god fraction of one then use a module name!</div><div><br></div><div>import module as _mod</div><div><br></div><div>then use _mod.Foo, etc.....</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:'courier new',monospace">Now, that may seem like a contrived example, but i've<br>witnessed much longer "run-on import lines" than that.</span></div></blockquote><div><br></div></span><div>I have too, but I think it's bad style -- if you are importing a LOT of names from one module, just import the darn module -- giving it a shorter name if you like. This has become a really standard practice, like:</div><div><br></div><div>import numpy as np</div><div><br></div><div>for instance.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:'courier new',monospace">The intended purpose is to: "automate the privatization of<br>public symbols during the import process".</span></div></blockquote><div><br></div></span>I'm really confused about the use case for "privatization of public symbols" at all, but again, if you need a lot of them, use the module name to prefix them. Heck give it a one character name, and then it's hardly more typing than the underscore...</div><div class="gmail_quote"><br></div><div class="gmail_quote">-CHB</div><span class="HOEnZb"><font color="#888888"><div class="gmail_quote"><br></div><div><br></div>-- <br><div class="m_8053654320201421033gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959</a> voice<br>7600 Sand Point Way NE <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329</a> fax<br>Seattle, WA 98115 <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317</a> main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</font></span></div></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br></blockquote></div><br></div>