Python: Confused with list.remove

后端 未结 3 1173
野趣味
野趣味 2021-01-11 18:27

I\'m very new to Python, so sorry for the probably simple question. (Although, I spent now 2 hours to find an answer)

I simplified my code to illustrate the problem

3条回答
  •  梦谈多话
    2021-01-11 18:57

    dusan's answer is correct, and is a clever approach, but I think it breaks the Zen of Python guideline that "Explicit is better than implicit."

    A far more common pattern I've seen to ensure an item is a deepcopy is with the copy module.

    >>> import copy
    >>> eva = copy.copy(side)
    

提交回复
热议问题