Clearing a list in place will affect all other references of the same list.
For example, this method doesn't affect other references:
>>> a = [1, 2, 3] >>> b = a >>> a = [] >>> print(a) [] >>> print(b) [1, 2, 3]But this one does:
>>> a = [1, 2, 3] >>> b = a >>> del a[:] # equivalent to del a[0:len(a)] >>> print(a) [] >>> print(b) [] >>> a is b TrueYou could also do:
>>> a[:] = []으아아!
파이썬 안씀 수고
당연한것... 뭐.. 새삼스럽게 하지만, 인스턴스가 새로 생성되는것과 기존 리스트의 데이터를 모두 삭제하는것으로 나뉘지... 위의 코드는