Closed as not planned
Description
Bug report
Bug description:
sorted() does shallow copy instead of deep copy as shown below. *It's problematic:
originlist = ['apple', 'banana', ['kiwi', 'cherry']]
newlist = sorted(originlist, key=len)
print(newlist) # [['kiwi', 'cherry'], 'apple', 'banana']
newlist[0][1] = 'CHERRY'
newlist[2] = 'BANANA'
print(newlist) # [['kiwi', 'CHERRY'], 'apple', 'BANANA']
print(originlist) # ['apple', 'banana', ['kiwi', 'CHERRY']]
# ↑↑↑↑↑↑↑↑
CPython versions tested on:
3.12
Operating systems tested on:
Windows