List replication operator

Stefan Behnel stefan_ml at behnel.de
Fri May 25 03:50:10 EDT 2018


Peter Otten schrieb am 25.05.2018 um 09:28:
> Steven D'Aprano wrote:
> 
>> But what do people think about proposing a new list replication with copy
>> operator?
>>
>>     [[]]**5
>>
>> would return a new list consisting of five shallow copies of the inner
>> list.
> 
> Yet another arcanum to learn for beginners with little return.
> If you cannot refrain from tinkering with the language at least concentrate 
> on the features with broad application.
> Thank you.

I might have phrased this a little less ... short, but if it's really just
about avoiding a call to "copy.deepcopy()" in certain special cases at the
cost of adding new syntax, then I have to agree that we'd better avoid
adding the syntax instead.

Stefan





More information about the Python-list mailing list