Bug in __init__?

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Jan 23 18:16:29 CET 2008


Bart Ogryczak a écrit :
> On 2008-01-22, citizen Bruno Desthuilliers testified:
>>> 			from copy import copy
>>> 			### see also deepcopy
>>> 			self.lst = copy(val)
>> What makes you think the OP wants a copy ?
> 
> I´m guessing he doesn´t want to mutate original list, while changing 
> contents of self.lst.

Once again: what makes you think so ?

This is a design choice depending on the concrete use case and context - 
which we don't know zilch about - and by no mean the default behaviour.




More information about the Python-list mailing list