On 25May2018 02:25, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
wrote:
On Thu, 24 May 2018 15:12:09 -0400, Ned Batchelder wrote:
On 5/24/18 2:17 PM, 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.
"shallow" will be the next problem. Do we also need this?:
[[[]]]***5 # j/k
You might be right: on further thought, I think I want deep copies, not
shallow.
Originally I thought that deep copies was an YAGNI. Have you *ever* seen
anyone complain that * didn't make a deep copy of the list contents? I
never have. But then I realised that if this works, people will surely
try to use it to make three-dimensional lists as well as two, and for
that we need deep copies.
In the deep copy scenario I am far far less opposed - _that_ is practically
exponential memory use, and so the "**" is much more apt :-)
I think I'm basicly against a shallow copy and not against a deep copy, because
the shallow copy only pushes the issue out one layer.
So, how to various forms of multidimensional lists play out as code?
Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list