Default Argument Inconsistency?

Paul Sweeney reverse.ku.oc.issolok at nothypgnal.delrest.co.uk
Tue Apr 27 06:25:17 EDT 2004


Ah, yes, got it :-)

I'm new to Python (4 months) and thought I'd figured the whole
immutable/mutable thang,
and this was bothering me.

Many thanks

Paul



"Diez B. Roggisch"  wrote ...

>
> No, its not. As [] is logically false, the
>
> if not L: L = []
>
> rebinds L with a fresh list. So the append is made to that list, not to
the
> one L is bound to as default argument.
>
>
> -- 





More information about the Python-list mailing list