On Fri, May 15, 2009 at 5:59 AM, George Sakkis
More to the point, immutability is *not* the issue as Steven D'Aprano showed. There are perfectly legitimate reasons for using a default value that just happens to be mutable, without mutating it in the function body though. Dict is the most common example (especially since there is no frozendict type that could be used in its place).
There seem to be two separate "wants" that relate to this topic: 1. Preventing the "noob" mistake of saying "def f(x = {})" and expecting that a new empty dictionary will be produced for each call, and 2. Creating a more concise syntax for saying def f(x = UNDEF): if x is UNDEF: x = {} So far, the discussion seems to have revolved entirely around the second request -- which I find by far less compelling than the first; it's simply not a painful-enough pattern to warrant a special bit of syntax. Furthermore, it doesn't do anything to address the first desire. -- Curt Hagenlocher curt@hagenlocher.org