Skip to content

Commit 1d1fac8

Browse files
暮晨leisurelicht
暮晨
authored andcommitted
EX.Same operands, different story
1 parent 0f25840 commit 1d1fac8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ So, here we go...
6161
- [> Loop variables leaking out!/循环变量泄漏!](#-loop-variables-leaking-out循环变量泄漏)
6262
- [> Beware of default mutable arguments!/当心默认的可变参数!](#-beware-of-default-mutable-arguments当心默认的可变参数)
6363
- [> Catching the Exceptions/捕获异常](#-catching-the-exceptions捕获异常)
64-
- [> Same operands, different story!](#-same-operands-different-story)
64+
- [> Same operands, different story!/同人不同命!](#-same-operands-different-story同人不同命)
6565
- [> The out of scope variable](#-the-out-of-scope-variable)
6666
- [> Be careful with chained operations](#-be-careful-with-chained-operations)
6767
- [> Name resolution ignoring class scope](#-name-resolution-ignoring-class-scope)
@@ -1680,7 +1680,7 @@ SyntaxError: invalid syntax
16801680
16811681
---
16821682
1683-
### > Same operands, different story!
1683+
### > Same operands, different story!/同人不同命!
16841684
16851685
1\.
16861686
```py
@@ -1712,13 +1712,13 @@ a += [5, 6, 7, 8]
17121712
[1, 2, 3, 4, 5, 6, 7, 8]
17131713
```
17141714
1715-
#### 💡 Explanation:
1715+
#### 💡 说明:
17161716
1717-
* `a += b` doesn't always behave the same way as `a = a + b`. Classes *may* implement the *`op=`* operators differently, and lists do this.
1717+
* `a += b` 并不总是与 `a = a + b` 表现相同. 类实现 *`op=`* 运算符的方式 *也许* 是不同的, 列表就是这样做的.
17181718
1719-
* The expression `a = a + [5,6,7,8]` generates a new list and sets `a`'s reference to that new list, leaving `b` unchanged.
1719+
* 表达式 `a = a + [5,6,7,8]` 会生成一个新列表, 并让 `a` 引用这个新列表, 同时保持 `b` 不变.
17201720
1721-
* The expression `a += [5,6,7,8]` is actually mapped to an "extend" function that operates on the list such that `a` and `b` still point to the same list that has been modified in-place.
1721+
* 表达式 `a += [5,6,7,8]` 实际上是使用的是 "extend" 函数, 所以 `a` `b` 仍然指向已被修改的同一列表.
17221722
17231723
---
17241724

0 commit comments

Comments
 (0)