list parameter of a recursive function

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Thu Oct 7 00:37:51 CEST 2010


On Wed, 06 Oct 2010 23:00:10 +0200, TP wrote:

> I think I prefer doing an explicit copy.copy, because it allows to
> remind the reader that it is very important to take care of that. 

I think a comment is better for that. It's better to explicitly say 
something is important than to assume the reader will guess.

Besides, what if the caller wants to supply their own list, and they 
*want* it modified in place rather than a copy made? (I have no idea why 
they might want this, but anything is possible...) You should avoid 
making copies except in methods that are *for* making copies.


-- 
Steven



More information about the Python-list mailing list