(1) When applying the rule would make the code less readable, even for
someone who is used to reading code that follows the rules.
(2) To be consistent with surrounding code that also breaks it (maybe for
historic reasons) -- although this is also an opportunity to clean up
someone else's mess (in true XP style).
如果要写Python的C扩展库,你还必须好好学习下PEP7
2. Code Like a Pythonista: Idiomatic Python
5. PEP333 Python Web Server Gateway Interface v1.0
如果你要用Python来做Web相关的开发(对大多说人来说主要就是指Web运用)WSGI是必读的,WSGI是Python web server、application、middleware之间的官方规范标准,现在主流的Python web server和framework都肯定支持WSGI的。只有了解了WSGI你才能更好的理解Python的web framework的工作机制、middleware为啥可以串联起来、web server是怎么跟web application交互的。WSGI有两个为人诟病的地方,一是不支持异步,Tornado是一个异步的Web server,但是若要在上面运行WSGI的framework如Django,则Tornado的异步特性完全用不上;二是WSGI v1.0不支持Python3.x,为了支持Python3.x,有两篇还在Draft状态的PEP文档PEP3333和PEP444可供参考。