<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #1740: Get rid of `from module import ...`</title>
    <link>http://localhost/ticket/1740</link>
    <description>&lt;p&gt;
It's really bad to do &lt;tt&gt;from module import *&lt;/tt&gt; and CKAN has a lot of them. I suggest a three-pronged approach:
&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Don't add any more of them.
&lt;/li&gt;&lt;/ol&gt;&lt;ol start="2"&gt;&lt;li&gt;When you're programming if you see an easy opportunity to remove one then do so.
&lt;/li&gt;&lt;/ol&gt;&lt;ol start="3"&gt;&lt;li&gt;At some point we should task someone to go through the code and remove them all (which is what this ticket is for), but this will be a big job and may break things.
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;
We should also get rid of most or all of the &lt;tt&gt;from module import foo&lt;/tt&gt; and &lt;tt&gt;from module import foo, bar&lt;/tt&gt; statements.
&lt;/p&gt;
&lt;p&gt;
I think the right thing to do is just &lt;tt&gt;import module&lt;/tt&gt; and then use &lt;tt&gt;module.foo&lt;/tt&gt; in your code. But if you find yourself doing &lt;tt&gt;module.foo.bar&lt;/tt&gt; then you may have a code smell.
&lt;/p&gt;
&lt;p&gt;
See: &lt;a class="ext-link" href="http://docs.python.org/dev/howto/doanddont.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://docs.python.org/dev/howto/doanddont.html&lt;/a&gt;
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/1740</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>dread</dc:creator>

      <pubDate>Wed, 01 Feb 2012 11:14:44 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/1740#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/1740#comment:1</guid>
      <description>
        &lt;p&gt;
I agree with getting rid of &lt;tt&gt;from module import *&lt;/tt&gt; and the approach suggested.
&lt;/p&gt;
&lt;p&gt;
However, I really disagree with getting rid of &lt;tt&gt;from x import y&lt;/tt&gt;. In particular we have a strong convention of using this for ckan.model. It is a valuable abbreviation as it is used so much in the logic layer and tests. If someone should accidentally reassign the value of model to something else then I believe it is simple to see what has gone wrong.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>