zoukankan      html  css  js  c++  java
  • pep8 && pep20

    pep8(部分,遇到问题再补充)

    1.不建议使用tab键来空格,避免不必要的空格。操作符左右各加一个空格,函数默认参数使用的赋值符左右省略空格。

    2.类和top-level函数定义之间空两行;类中的方法定义之间空一行;函数内逻辑无关段落之间空一行;其他地方尽量不要再空行。

    4.换行用反斜杠,建议用圆括号。

    5.import部分,按标准、三方和自己编写顺序依次排放,之间空一行。

    6.不建议在一句中import多个。

    7.尽量用"is""is not"代替"=="

    pep20

    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!

  • 相关阅读:
    摄影基础知识(二)
    std::bind
    摄影网站汇总
    std::function
    常用路径说明
    摄影基础知识(一)
    JavaScript 箭头函数:适用与不适用场景
    软帝学院:Java实现的5大排序算法
    软帝学院:用Java编写计算器,代码展示!
    windows环境下运行java的脚本
  • 原文地址:https://www.cnblogs.com/jdbc2nju/p/7364648.html
Copyright © 2011-2022 走看看