2

For example, if I write only :

l = [1, 2, 3]
l[1:2]

Is the slice from the list saved in memory? Does it take any space in memory?

Ma0
  • 15,057
  • 4
  • 35
  • 65
  • 4
    Does the slice take up space? Yes. Is the slice saved? Yes, until it is garbage collected. Without any references pointing to it, the gc will get rid of it eventually. – cs95 Jan 17 '18 at 15:17
  • https://stackoverflow.com/questions/4948293/python-slice-assignment-memory-usage – Buzz Jan 17 '18 at 15:19

0 Answers0