Python 3.12.14
str 不可变: 'str' object does not support item assignment
元组里的列表被改了: (1, [2, 3, 4])
因此这个元组不可哈希: unhashable type: 'list'
bad : [1, 2] [1, 2]
good: [1] [2]
元组做键: 5.0
核验记录:19_mutability.txt
与教程配套的原始示例或核验资料,保留完整内容;其中真实用户目录已脱敏,运行范围以记录本身为准。
与教程配套的原始示例或核验资料,保留完整内容;其中真实用户目录已脱敏,运行范围以记录本身为准。
Python 3.12.14
str 不可变: 'str' object does not support item assignment
元组里的列表被改了: (1, [2, 3, 4])
因此这个元组不可哈希: unhashable type: 'list'
bad : [1, 2] [1, 2]
good: [1] [2]
元组做键: 5.0