0

I am quite new to python and am trying to understand this code (from https://github.com/yoctoproject/poky/blob/master/meta/classes/insane.bbclass#L803 ):

a = b[:]

Why not rather use this simple form for copying a list?

a = b
Étienne
  • 4,773
  • 2
  • 33
  • 58
  • Because `a = b` doesn't copy `b`, it simply makes the `a` object reference the `b` object. Later, if `b` is changed, the changes will show up in `a` as well. – MattDMo Aug 04 '22 at 16:00
  • @MattDMo ok thanks. Do you want to add this as an answer? or simply close? – Étienne Aug 04 '22 at 16:02
  • 1
    I already closed it as a dupe. There's more in-depth explanations there. – MattDMo Aug 04 '22 at 16:03

0 Answers0