<story><title>Anti-Patterns in Python Programming</title><url>http://lignos.org/py_antipatterns/</url></story><parent_chain><item><author>tribaal</author><text>The more frequent and dangerous pitfalls are, in my humble opinion:&lt;p&gt;- Bare except: statements (that catches &lt;i&gt;everything&lt;/i&gt;, even Ctrl-C)&lt;p&gt;- Mutables as default function&amp;#x2F;method arguments&lt;p&gt;- Wildcard imports!</text></item></parent_chain><comment><author>SEJeff</author><text>Couldn&amp;#x27;t agree more! One of my all time new python interview questions gets a surprisingly large number of developers.&lt;p&gt;Given a function like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def append_one(l=[]):

        l.append(1)

        return l

&lt;/code&gt;&lt;/pre&gt;
What does this return each time?&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;gt;&amp;gt;&amp;gt; append_one()

    &amp;gt;&amp;gt;&amp;gt; append_one()

    &amp;gt;&amp;gt;&amp;gt; append_one()&lt;/code&gt;&lt;/pre&gt;</text></comment>
<story><title>Anti-Patterns in Python Programming</title><url>http://lignos.org/py_antipatterns/</url></story><parent_chain><item><author>tribaal</author><text>The more frequent and dangerous pitfalls are, in my humble opinion:&lt;p&gt;- Bare except: statements (that catches &lt;i&gt;everything&lt;/i&gt;, even Ctrl-C)&lt;p&gt;- Mutables as default function&amp;#x2F;method arguments&lt;p&gt;- Wildcard imports!</text></item></parent_chain><comment><author>scott_w</author><text>Possibly the most interesting anti-pattern I saw was:&lt;p&gt;a_list_of_words = &amp;quot;my list of words&amp;quot;.split(&amp;quot; &amp;quot;)&lt;p&gt;I never enquired why, since there were bigger issues in the code e.g. &amp;quot;unit testing&amp;quot; by running the code, taking the result and putting it as the check value. By running repr(value), copying out the string then comparing self.assertEqual(repr(value), &amp;#x27;[&amp;lt;Object1: unicode_value&amp;gt;, ...]&amp;#x27;)</text></comment>