style: html to md syntax

This commit is contained in:
Plumbiu
2023-08-24 10:31:27 +08:00
parent 229e847514
commit 0a96f3658b
88 changed files with 459 additions and 459 deletions

View File

@@ -37,7 +37,7 @@ iterator = iter(iterable)
# do something
```
- 首先,在可迭代对象上调用内置 `iter` 函数以创建对应的<em>迭代器</em>
- 首先,在可迭代对象上调用内置 `iter` 函数以创建对应的*迭代器*
- 要获取序列中的下一个元素,在此迭代器上调用内置 `next` 函数。
如果没有下一个元素了,怎么办?
@@ -76,7 +76,7 @@ StopIteration
## 英语练习,对迭代器的类比
<strong>Analogy</strong>: An iterable is like a book (one can flip through the pages) and an iterator for a book would be a bookmark (saves the position and can locate the next page). Calling `iter` on a book gives you a new bookmark independent of other bookmarks, but calling `iter` on a bookmark gives you the bookmark itself, without changing its position at all. Calling `next` on the bookmark moves it to the next page, but does not change the pages in the book. Calling `next` on the book wouldn't make sense semantically. We can also have multiple bookmarks, all independent of each other.
**Analogy**: An iterable is like a book (one can flip through the pages) and an iterator for a book would be a bookmark (saves the position and can locate the next page). Calling `iter` on a book gives you a new bookmark independent of other bookmarks, but calling `iter` on a bookmark gives you the bookmark itself, without changing its position at all. Calling `next` on the bookmark moves it to the next page, but does not change the pages in the book. Calling `next` on the book wouldn't make sense semantically. We can also have multiple bookmarks, all independent of each other.
## 生成器:懒人迭代器!