Merge pull request #73 from 0x0400/patch-3
Update 3-tips-on-numbers-and-strings.md
This commit is contained in:
commit
d3f4b9896a
|
@ -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` 替换它。
|
||||
|
||||
所以,**当我们的代码中需要出现复杂计算的字面量时,请保留整个算式吧。它对性能没有任何影响,而且会增加代码的可读性。**
|
||||
|
||||
|
|
Loading…
Reference in New Issue