On Sat, May 26, 2018 at 1:46 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 25 May 2018 18:06:00 +1000, Chris Angelico wrote: > >> Downside: while it's all very well to say that this is equivalent to >> copy.deepcopy(), that would imply replicating copy.deepcopy's semantics >> in the core list type (unless it's actually literally defined as >> importing a module and calling a function), and deepcopy is a >> complicated function. > > Betcha it's not as complicated as the import statement, and the bulk of > that is now implemented as pure Python :-) > > But you make a good point: deep copying is not a trivial operation. >
Heh, true. But "a good bit" is not quite the same as if you had (don't shoot me, this is just hypothetical) "spam".import() as a way to obtain the same module you'd get from 'import spam'. To be a method/operator on a core data type, it basically *all* has to be implemented in C, otherwise there are going to be awkwardnesses. I don't think that kills your idea, but it does mean it's a nontrivial enhancement to the list type. ChrisA -- https://mail.python.org/mailman/listinfo/python-list