List replication operator

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri May 25 18:31:15 EDT 2018


On Fri, 25 May 2018 13:05:01 -0400, Dennis Lee Bieber wrote:

> 	Let me play devil's advocate... and propose a simple change, with 
no
> new operators...
> 
> 	sl = [] * n	#current behavior
> 	dl = n * []	#deep copy behavior

n*[] is already supported. You will suddenly change the behaviour of any 
existing Python code that uses it, depending on which version they happen 
to use.



-- 
Steve




More information about the Python-list mailing list