python 之禅 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites div class="sep5">
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wccandww
V2EX    Python

python 之禅

  •  
  •   wccandww 2011-01-18 18:15:57 +08:00 6105 次点击
    这是一个创建于 5389 天前的主题,其中的信息可能已经有所发展或是发生改变。
    followers_count
    3 条回复    1970-01-01 08:00:00 +08:00
    wccandww
        1
    wccandww  
    OP
       2011-01-18 18:17:09 +08:00
    import this
    >>>
    The Zen of Python, by Tim Peters

    Beautiful is better than ugly.
    漂亮的代码要比丑陋的代码要好得多。
    Explicit is better than implicit.
    明确的定义比 隐式定义更好。
    Simple is better than complex.
    简单比负责要好。
    Complex is better than complicated.
    负责要比搞复杂要好。
    Flat is better than nested.
    扁平结构要比嵌套结构好。
    Sparse is better than dense.
    简洁明了的代码要比稠密的代码要好。
    Readability counts.
    可读写的计数。
    Special cases aren't special enough to break the rules.
    专门的用例不是特殊到足以违反规则。
    Although practicality beats purity.
    是的,实用性练就纯度。
    Errors should never pass silently.
    错误永远都不会沉默。
    Unless explicitly silenced.
    除非明确啥也不干。
    In the face of ambiguity, refuse the temptation to guess.
    面对模糊定义、拒绝视图拍脑袋猜。
    There should be one-- and preferably only one --obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch.
    虽然一开始不那面明确,我们会选择更清晰一条到走。
    Now is better than never.
    现在开始总比不开始的要好。
    Although never is often better than *right* now.
    虽然从不尝试总比现在开始尝试好。
    If the implementation is hard to explain, it's a bad idea.
    如果实现难以说明,那它是个坏主意。
    If the implementation is easy to explain, it may be a good idea.
    如果实现容易说明,那它是个好主意。
    Namespaces are one honking great idea -- let's do more of those!
    名称空间是一个好东西让我们做更多那样的东西!



    Don't reinvent the wheel

    Before writing any code,

    Check Python's standard library.

    Check the Python Package Index (the "Cheese Shop"):

    http://cheeseshop.python.org/pypi

    Search the web. Google is your friend.



    python 八荣八耻
    以动手实践为荣 , 以只看不练为耻;
    以打印日志为荣 , 以单步跟踪为耻;
    以空格缩进为荣 , 以制表缩进为耻;
    以单元测试为荣 , 以人工测试为耻;

    以模块复用为荣 , 以复制粘贴为耻;
    以多态应用为荣 , 以分支判断为耻;
    以Pythonic为荣 , 以冗余拖沓为耻;
    以总结分享为荣 , 以X求其解为耻;
    dongbeta
        2
    dongbeta  
       2011-01-18 18:24:56 +08:00
    翻译得不好
    pennyg
        3
    pennyg  
       2011-01-18 21:15:46 +08:00
    readability counts翻译错了。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5420 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 01:18 PVG 09:18 LAX 18:18 JFK 21:18
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86