News for hackers. Stuff that matters.
Re:Python's Mutable Default Problem by crystalis on Sunday February 20, 2011 @01:34PM (#2242617)
That hides default logic in the signature. Why would you favor that over

  def f(a=3, b=None):
    b = b or a+1 # or use a more explicit version
    return (a + b) / 2
Re:Python's Mutable Default Problem by chc on Sunday February 20, 2011 @04:38PM (#2243178)
That is code is logically convoluted — that's one reason not to love it. Why do you think is the more straightforward statement, just in general?

- "Let B be one greater than A unless otherwise specified."

- "We have no default value for B. If B has a value, then let B be equal to that value. If B does not have a value, then let B be one greater than A."

Re:Python's Mutable Default Problem by sjs on Sunday February 20, 2011 @08:05PM (#2243775)
Because that can be said more succinctly. It is even easier to read as there is less to read, which I realize is mostly subjective.
Re:Python's Mutable Default Problem by crystalis on Sunday February 20, 2011 @09:33PM (#2244009)
I'm pretty sure this is the same argument used to make Perl a bad guy.
Re:Python's Mutable Default Problem by sjs on Monday February 21, 2011 @01:22AM (#2244478)
I disagree, but we've gotten a bit off topic.

I think Python's behaviour is confusing and basically never what anyone actually wants. Regardless of whether or not you can use other params in defaults, the defaults should be evaluated on each call.