Article Outline

# 如何从容应对含有过多 “过早引用” 的知识？

“过早引用”（Forward References，另译为 “前置引用”），原本是计算机领域的术语。

``print(an_undefined_variable)``
``````---------------------------------------------------------------------------

NameError                                 Traceback (most recent call last)

<ipython-input-1-7e0e1cc14e37> in <module>
----> 1 print(an_undefined_variable)

NameError: name 'an_undefined_variable' is not defined``````

## 磨练 “只字不差” 的能力

Loop statements may have an else clause; it is executed when the loop terminates through exhaustion of the list (with for) or when the condition becomes false (with while), but not when the loop is terminated by a break statement. This is exemplified by the following loop, which searches for prime numbers:

``````for n in range(2, 10):
for x in range(2, n):
if n % x == 0:
print(n, 'equals', x, '*', n//x)
break
else:
# loop fell through without finding a factor
print(n, 'is a prime number')``````

2 is a prime number 3 is a prime number 4 equals 2 * 2 5 is a prime number 6 equals 2 * 3 7 is a prime number 8 equals 2 * 4 9 equals 3 * 3

• 要么干脆就没读过，
• 要么是读了，却没读到这个细节……

—— 后者更为可怕，跟花了同样的钱看了另外一个残缺版本的电影似的……

## 好的记忆力很重要

“就算读不懂也要读完” 的更高境界，是 “就算不明白也要先记住”。

## 尽快开始整理归纳总结

Python 官方网站上的 The Python Tutorial，是公认的最好的 Python 教材 —— 因为那是 Python 语言的作者 Guido van Rossum 写的……

• More Control Flow Tools
• More on Defining Functions
• More on Lists
• More on Conditions
• More on Modules

https://nvie.com/posts/iterators-vs-generators/

I'm writing this post as a pocket reference for later.

## 尊重前人的总结和建议

Python 中有一个概念叫 PEP，Python Enhancement Proposals，必须找时间阅读，反复阅读，牢记于心：

https://www.python.org/dev/peps/pep-0008/

1. ^ 也可能真的会死…… 请看一篇 2018 年 9 月份的一则新闻，发生在旧金山的事情：Developer goes rogue, shoots four colleagues at ERP code maker