Now following [my series of "python newbie questions"](https://stackoverflow.com/questions/2634091/python-some-newbie-questions-on-sys-stderr-and-using-function-as-argument/2635912#2635912) and based on [another question](https://stackoverflow.com/questions/575196/python-variable-scope-and-function-calls/575337#575337).

Prerogative
-----------

Go to <http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables> and scroll down to "Default Parameter Values". There you can find the following:

```
def bad_append(new_item, a_list=[]):
    a_list.append(new_item)
    return a_list

def good_append(new_item, a_list=None):
    if a_list is None:
        a_list = []
    a_list.append(new_item)
    return a_list

```

There's even an ["Important warning" on python.org](http://docs.python.org/tutorial/controlflow.html#default-argument-values) with this very same example, tho not really saying it's "better".

One way to put it
-----------------

So, question here is: why is the *"good" syntax over a known issue* ugly like that in a programming language that [promotes "elegant syntax" and "easy-to-use"](http://wiki.python.org/moin/BeginnersGuide/Overview)?

*edit:*

Another way to put it
---------------------

I'm not asking *[why or how it happens](https://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument)* (thanks Mark for the link).

I'm asking **why there's no simpler alternative built-in the language**.

I think a better way would probably being able to do something in the `def` itself, in which the name argument would be attached to a "local", or "new" within the `def`, mutable object. Something like:

```
def better_append(new_item, a_list=immutable([])):
    a_list.append(new_item)
    return a_list

```

I'm sure someone can come with a better syntax, but I'm also guessing there must be a very good explanation to why this hasn't been done.