Skip to content

Commit a9b080a

Browse files
暮晨ducheng
暮晨
authored and
ducheng
committed
EX.From filled to None in one instruction
1 parent 3747e58 commit a9b080a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ So, here we go...
4646
- [> Mutating the immutable!/强人所难](#-mutating-the-immutable强人所难)
4747
- [> The disappearing variable from outer scope/消失的外部变量](#-the-disappearing-variable-from-outer-scope消失的外部变量)
4848
- [> When True is actually False/真亦假](#-when-true-is-actually-false真亦假)
49-
- [> From filled to None in one instruction...](#-from-filled-to-none-in-one-instruction)
49+
- [> From filled to None in one instruction.../从有到无...](#-from-filled-to-none-in-one-instruction从有到无)
5050
- [> Subclass relationships *](#-subclass-relationships-)
5151
- [> The mysterious key type conversion *](#-the-mysterious-key-type-conversion-)
5252
- [> Let's see if you can guess this?](#-lets-see-if-you-can-guess-this)
@@ -1063,7 +1063,7 @@ I've lost faith in truth!
10631063
10641064
---
10651065
1066-
### > From filled to None in one instruction...
1066+
### > From filled to None in one instruction.../从有到无...
10671067
10681068
```py
10691069
some_list = [1, 2, 3]
@@ -1085,9 +1085,9 @@ None
10851085
None
10861086
```
10871087
1088-
#### 💡 Explanation
1088+
#### 💡 说明:
10891089
1090-
Most methods that modify the items of sequence/mapping objects like `list.append`, `dict.update`, `list.sort`, etc. modify the objects in-place and return `None`. The rationale behind this is to improve performance by avoiding making a copy of the object if the operation can be done in-place (Referred from [here](http://docs.python.org/2/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list))
1090+
大多数修改序列/映射对象的方法, 比如 `list.append`, `dict.update`, `list.sort` 等等. 都是原地修改对象并返回 `None`. 这样做的理由是, 如果操作可以原地完成, 就可以避免创建对象的副本来提高性能. (参考[这里](http://docs.python.org/2/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list))
10911091
10921092
---
10931093

0 commit comments

Comments
 (0)