Update 3-tips-on-numbers-and-strings.md

This commit is contained in:
Xingang Zhang 2021-08-12 20:00:53 +08:00 committed by GitHub
parent 40529a62db
commit 1ad26e463b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -198,7 +198,7 @@ dis.dis(f1)
14 RETURN_VALUE
```
看见上面的 `2 LOAD_CONST 1 (950400)` 了吗?这表示 Python 解释器在将源码编译成成字节码时,会计算 `11 * 24 * 3600` 这段表达式,并用 `950400` 替换它。
看见上面的 `2 LOAD_CONST 1 (950400)` 了吗?这表示 Python 解释器在将源码编译成成字节码时,会计算 `11 * 24 * 3600` 这段表达式,并用 `950400` 替换它。
所以,**当我们的代码中需要出现复杂计算的字面量时,请保留整个算式吧。它对性能没有任何影响,而且会增加代码的可读性。**