Skip to content

Commit 12268c7

Browse files
author
暮晨
committed
EX.Teleportation
1 parent 70cef9f commit 12268c7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ So, here we go...
5252
- [> Let's see if you can guess this?/看看你能否猜到这一点?](#-lets-see-if-you-can-guess-this看看你能否猜到这一点)
5353
- [Section: Appearances are deceptive!](#section-appearances-are-deceptive)
5454
- [> Skipping lines?/跳过一行?](#-skipping-lines跳过一行)
55-
- [> Teleportation *](#-teleportation-)
55+
- [> Teleportation/空间移动 *](#-teleportation空间移动-)
5656
- [> Well, something is fishy...](#-well-something-is-fishy)
5757
- [Section: Watch out for the landmines!](#section-watch-out-for-the-landmines)
5858
- [> Modifying a dictionary while iterating over it](#-modifying-a-dictionary-while-iterating-over-it)
@@ -1267,17 +1267,17 @@ False
12671267
12681268
---
12691269
1270-
### > Teleportation *
1270+
### > Teleportation/空间移动 *
12711271
12721272
```py
12731273
import numpy as np
12741274
12751275
def energy_send(x):
1276-
# Initializing a numpy array
1276+
# 初始化一个 numpy 数组
12771277
np.array([float(x)])
12781278
12791279
def energy_receive():
1280-
# Return an empty numpy array
1280+
# 返回一个空的 numpy 数组
12811281
return np.empty((), dtype=np.float).tolist()
12821282
```
12831283
@@ -1288,12 +1288,12 @@ def energy_receive():
12881288
123.456
12891289
```
12901290
1291-
Where's the Nobel Prize?
1291+
谁来给我发个诺贝尔奖?
12921292
1293-
#### 💡 Explanation:
1293+
#### 💡 说明:
12941294
1295-
* Notice that the numpy array created in the `energy_send` function is not returned, so that memory space is free to reallocate.
1296-
* `numpy.empty()` returns the next free memory slot without reinitializing it. This memory spot just happens to be the same one that was just freed (usually, but not always).
1295+
* 注意在 `energy_send` 函数中创建的 numpy 数组并没有返回, 因此内存空间被释放并可以被重新分配.
1296+
* `numpy.empty()` 直接返回下一段空闲内存,而不重新初始化. 而这个内存点恰好就是刚刚释放的那个(通常情况下, 并不绝对).
12971297
12981298
---
12991299

0 commit comments

Comments
 (0)