Python slice without copy? [duplicate] Python slice without copy? [duplicate] python-3.x python-3.x

Python slice without copy? [duplicate]


Use islice from itertools library

EDIT:

I see where I misunderstood the question.Well, there is no such thing. If you want to create your class, you'll have to:

  1. Keep a reference to the original list in you Slice class
  2. Define, __iter__, __getitem__ and __setitem__ methods to work on the original list with index conversion