You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [> Deep down, we're all the same. *](#-deep-down-were-all-the-same-)
32
32
- [> For what?](#-for-what)
@@ -209,7 +209,8 @@ False
209
209
210
210
---
211
211
212
-
### > Time for some hash brownies!
212
+
### > Time for some hash brownies!/是时候来点蛋糕了!
213
+
*hash brownie指一种含有大麻成分的蛋糕, 所以这里是句双关
213
214
214
215
1\.
215
216
```py
@@ -229,21 +230,21 @@ some_dict[5] = "Python"
229
230
"Python"
230
231
```
231
232
232
-
"Python"destroyed the existence of "JavaScript"?
233
+
"Python"消除了 "JavaScript" 的存在?
233
234
234
-
#### 💡 Explanation
235
+
#### 💡 说明:
235
236
236
-
* Python dictionaries check for equality and compare the hash value to determine if two keys are the same.
237
-
*Immutable objects with same value always have the same hashin Python.
237
+
* Python 字典通过检查键值是否相等和比较哈希值来确定两个键是否相同.
238
+
*具有相同值的不可变对象在Python中始终具有相同的哈希值.
238
239
```py
239
240
>>>5==5.0
240
241
True
241
242
>>>hash(5) ==hash(5.0)
242
243
True
243
244
```
244
-
**Note:**Objects with different values may also have same hash (known ashash collision).
245
-
*When the statement `some_dict[5] = "Python"`is executed, the existing value "JavaScript"is overwritten with"Python" because Python recognizes `5`and`5.0`as the same keys of the dictionary `some_dict`.
246
-
*This StackOverflow [answer](https://stackoverflow.com/a/32211042/4354153) explains beautifully the rationale behind it.
0 commit comments