python 賦值變量和賦值對象的可變性

對象變更(Mutation) Python中可變(mutable)與不可變(immutable)的數據類型讓新手非常頭痛。簡單的說,可變(mutable)意味着"能夠被改動",而不可變(immutable)的意思是「常量(constant)」。想把腦筋轉動起來嗎?考慮下這個例子:python foo = ['hi'] print(foo) # Output: ['hi'] bar = foo ba
相關文章
相關標籤/搜索