what does 'a=b=c=[]' do

alex23 wuwei23 at gmail.com
Thu Dec 22 21:10:46 EST 2011


On Dec 22, 6:51 pm, Rolf Camps <r... at roce.be> wrote:
> I'm afraid it's dangerous to encourage the use of '[]' as assignment to
> a parameter in a function definition. If you use the function several
> times 'default' always points to the same list.

I appreciate the concern, but adding a default argument guard would
not only obscure the code. It's irrelevant, as you recognise, because
no matter what, it's going to make copies of the default argument.

You know what the say about foolish consistencies :)



More information about the Python-list mailing list