7 ? s9 P3 k5 L; s ' @( {8 M2 S( Z0 \0 t( K3 [8 S2 G % f7 N3 A- c6 J0 }0x03 一幅厚颜无耻的漫画 " B H$ ?3 v) s8 M1 i2 L x4 t6 } d' i$ l
. }+ i5 t! \# u, j. X N7 X, u6 G输入下面这行代码,你会跳转到一个漫画网页: & N5 T- |* K9 g5 R$ H, T$ U- b+ S5 z& x) v* E
>>> import antigravity # e' d! d; }* a* T14 Q6 y' o, \2 u! f; D
& {: g+ G |7 w- N
网址是:https://xkcd.com/353/ 7 ?2 f/ [2 H. J6 ~ ) q1 D. }, X& {0 B& B: T 8 @7 H- S. |3 I' k5 h! M; h4 w9 J# a0 u: V( g/ K
" U; p4 Y6 P$ [$ c& M7 T( J7 ]
就是上面这个图…4 }- e( u9 i6 X* [+ c& O
真的是搞笑,都是英文,我怎么看的懂嘛… 2 N6 s4 ]) w( o5 z" ]0 Z一键翻译…7 N3 h; S1 d) U3 C
; T9 x9 |9 {7 p% q w, y4 w/ H7 G* c奥,这个我知道,不就是说 Python 语法简单,功能牛批么…( W* L P R' H* ]
果然是…直接。 - g& b8 M" s2 u & Q( b1 V1 D) O + m" B( x+ ^7 @; g 2 O; w/ t- v S6 W+ e( \ 8 o$ h" L& H ?* } 5 V/ Q3 [& _8 F+ D9 n( t' g) c2 m5 x+ \* }, }0 U# b$ e
0x04 爱是什么?2 u$ b8 f, r9 d5 b" g; x+ t6 A
5 t" Y. n: R3 ~! L A
" ^ W5 G0 R& Q# T% K
估计每个 Python 人儿都知道 Python 之禅,不知道也没事,就是下面这个东西:4 V; i. {- y4 t1 n# \, x
. y* [9 u/ K! F z; L0 h* E0 n# g' W- L
>>> import this2 K, W+ n2 z* } `* l
1* U$ O k, w' d; P& E9 K K9 u6 b: p
% Z3 y& @( N* }: K& M5 `7 q一键回车: $ M% o9 l# Q% m T+ h" A& H % q2 t G- ^" N+ G" j9 k5 e9 W, s; y* p: h- w' b) _
The Zen of Python, by Tim Peters' l' e) T- I- D6 V
3 ?( M% P9 l N. M) c" vBeautiful is better than ugly. * N6 F( L0 Q/ mExplicit is better than implicit. : |( O# e, i" D6 @0 ]# S7 fSimple is better than complex.6 f. L" e7 v4 M% H( q$ c% }+ X
Complex is better than complicated. + W2 ] W. `8 C. U7 V; C/ \, JFlat is better than nested.7 K g9 M2 s$ n3 v, j
Sparse is better than dense.8 _, w) ^7 I6 J8 y
Readability counts.; J- d9 R+ ], l. z+ W4 F( _
Special cases aren't special enough to break the rules.' a5 L) Z( R( J( N$ G3 s9 O# A {
Although practicality beats purity. 4 x ~& ?9 ~* z/ lErrors should never pass silently. ( b- F, Y2 k% ]( q3 GUnless explicitly silenced. 7 B% a8 w- X$ A" BIn the face of ambiguity, refuse the temptation to guess.0 j# q0 H) x5 `" g5 g/ C5 _
There should be one-- and preferably only one --obvious way to do it.) J# _7 h8 n+ m" I$ Y" o& @
Although that way may not be obvious at first unless you're Dutch." N4 M; n# e* u. d0 Q) t
Now is better than never.* p1 e7 C6 u1 S0 r! |* L
Although never is often better than *right* now.; i/ T B2 ]" L t* \
If the implementation is hard to explain, it's a bad idea.5 q& M7 [: @* `
If the implementation is easy to explain, it may be a good idea. e% A$ {% n, ~: PNamespaces are one honking great idea -- let's do more of those! 2 g7 P# w5 J5 @. I# r" z" A" U; X( B6 }4 m" i) g
具体翻译如下:) n# \/ m2 T8 q4 V: g6 {4 B/ O0 t