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

alex23 wuwei23 at gmail.com
Fri Dec 23 01:00:51 EST 2011


On Dec 23, 3:22 pm, Ian Kelly <ian.g.ke... at gmail.com> wrote:
> Nobody is asking you to modify your coding style.  The request is that
> you not throw it up as an example without mentioning the important
> caveats.

No, 100% no. It's not my responsibility to mention every potentially
relevant gotcha when providing example code.

> Also, novice programmer == bad programmer?

If they're wholly learning how to code by throwaway examples on
mailing lists, then yes. Object mutability is a _major_ aspect of
Python; I'm simply not going to inject an essay explaining what that
implies every time I choose to use a mutable default argument.



More information about the Python-list mailing list