List replication operator

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri May 25 12:49:10 EDT 2018


On Fri, 25 May 2018 17:12:12 +0100, bartc wrote:

> On 25/05/2018 16:40, Steven D'Aprano wrote:
[...]
>> On the other hand, it is arguable that what we really need is a
>> standard function to return an N-dimensional array/list:
>> 
>> # return a 3x4x5x6 4-D list initialised to all zeroes arr =
>> list.dimensions(3, 4, 5, 6, initial=0.0)
>
> What stops you just writing such a function?

Who says I haven't already?

Whether I have or not is not relevant to the question I'm asking.

Not every one-line function needs to be a built-in, but this is NOT a one-
line function, it isn't obviously easy to implement the right way (I 
started off thinking that shallow copies was the right solution, but then 
changed my mind), it is a repeated pain point in the language and a 
frequent gotcha.



-- 
Steve




More information about the Python-list mailing list