<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>nbadg</author><text>Are you referring persistence of mutable default args? Which then potentially leads to bugs when you treat it as a new variable on each function call?&lt;p&gt;This is intentional behavior. It&amp;#x27;s the result of one-time evaluation of default args, which is important for memoization. It&amp;#x27;s also really useful in combination with late-binding closures. For example, using a lambda as a generator function:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def create_multipliers():
        return [lambda x : i * x for i in range(5)]
&lt;/code&gt;&lt;/pre&gt;
This doesn&amp;#x27;t work, you&amp;#x27;ll get all 8&amp;#x27;s. Instead you need to:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def create_multipliers():
        return [lambda x, i=i : i * x for i in range(5)]
&lt;/code&gt;&lt;/pre&gt;
Late-binding closures and memoization strategies are pretty core language features; I wouldn&amp;#x27;t expect them to change (and many python devs would be pretty pissed if they did). Yes, this can be confusing with mutable default objects, but the alternative is to have disparate behavior depending on the mutability of the defaults, which would be an utter catastrophe.&lt;p&gt;&lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;docs.python-guide.org&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;writing&amp;#x2F;gotchas&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;docs.python-guide.org&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;writing&amp;#x2F;gotchas&amp;#x2F;&lt;/a&gt;</text><parent_chain><item><author>eiopa</author><text>This kills it for me too. I rely on pypy, and I just can&amp;#x27;t see myself sacrificing my productivity by using Six.&lt;p&gt;Also, Python 3 neglected to fix one of the most annoying things about the language - default arg value&lt;p&gt;&lt;pre&gt;&lt;code&gt;  def foo(x=[]):
      x.append(1)
      print x
  
  foo() # 1
  foo() # 1 1
&lt;/code&gt;&lt;/pre&gt;
Why is this still busted??</text></item><item><author>sitkack</author><text>I moved last month and I have been using Python since 1.5.2&lt;p&gt;What prevents me from recommending it to everyone I pass on the street is that the PyPy 3.x line is back on 3.2.5 which makes it not compatible with many libs which have a 3.3 minimum, which is most. Yes, I give to pypy.org &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;pypy.org&amp;#x2F;py3donate.html&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;pypy.org&amp;#x2F;py3donate.html&lt;/a&gt;&lt;p&gt;Recommendations to folks&lt;p&gt;&lt;pre&gt;&lt;code&gt;  * switch your daily interpreter to Python3
  * use tox, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;tox
  * use six, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;six
  * when you go native, go cffi, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;cffi&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain></comment><story><title>Where are we in the Python 3 transition?</title><url>http://www.snarky.ca/the-stages-of-the-python-3-transition</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>throwaway91919</author><text>Can you (or someone) clarify what problem you&amp;#x27;re talking about?  This seems to work as expected for me:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def foo(x=[]):
        sum = 0
        for a in x: sum += a
        return sum
    print foo([3,5])  # 8
    print foo(x=[3]) # 3
    print foo([]) # 0
    print foo() # 0
&lt;/code&gt;&lt;/pre&gt;
Is it the fact that kwargs are required to have defaults? Or what?</text><parent_chain><item><author>eiopa</author><text>This kills it for me too. I rely on pypy, and I just can&amp;#x27;t see myself sacrificing my productivity by using Six.&lt;p&gt;Also, Python 3 neglected to fix one of the most annoying things about the language - default arg value&lt;p&gt;&lt;pre&gt;&lt;code&gt;  def foo(x=[]):
      x.append(1)
      print x
  
  foo() # 1
  foo() # 1 1
&lt;/code&gt;&lt;/pre&gt;
Why is this still busted??</text></item><item><author>sitkack</author><text>I moved last month and I have been using Python since 1.5.2&lt;p&gt;What prevents me from recommending it to everyone I pass on the street is that the PyPy 3.x line is back on 3.2.5 which makes it not compatible with many libs which have a 3.3 minimum, which is most. Yes, I give to pypy.org &lt;a href=&quot;http:&amp;#x2F;&amp;#x2F;pypy.org&amp;#x2F;py3donate.html&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;pypy.org&amp;#x2F;py3donate.html&lt;/a&gt;&lt;p&gt;Recommendations to folks&lt;p&gt;&lt;pre&gt;&lt;code&gt;  * switch your daily interpreter to Python3
  * use tox, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;tox
  * use six, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;six
  * when you go native, go cffi, https:&amp;#x2F;&amp;#x2F;pypi.python.org&amp;#x2F;pypi&amp;#x2F;cffi&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain></comment><story><title>Where are we in the Python 3 transition?</title><url>http://www.snarky.ca/the-stages-of-the-python-3-transition</url></story>