Python: create sublist without copying

前端 未结 4 933
执笔经年
执笔经年 2021-02-13 16:35

I have a question about how to create a sublist (I hope this is the right term to use) from a given list without copying.

It seems that slicing can create sublists, but

4条回答
  •  别那么骄傲
    2021-02-13 17:05

    There is no built-in way to do this. You could create your own list-like class that takes a reference to a list and reimplements all of the list accessor methods to operate on it.

提交回复
热议问题