> 
> **Possible Duplicate:**  
> 
> [“Least Astonishment” in Python: The Mutable Default Argument](https://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument) 
> 
> 
> 

I'm kind of confused about how optional parameters work in Python functions/methods.

I have the following code block:

```
>>> def F(a, b=[]):
...     b.append(a)
...     return b
...
>>> F(0)
[0]
>>> F(1)
[0, 1]
>>>

```

Why `F(1)` returns `[0, 1]` and not `[1]`?

I mean, **what is happening inside**?