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