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!

  • 相关阅读:
    OpenCV 3-1.1-头文件
    安装ROS报错:The following packages have unmet dependenctes:
    机器人学——3.3-逆运动学
    机器人学——3.2-正运动学
    机器人学——3.1-机械臂DH参数
    机器人学——2.4-坐标系的旋转和运动增量
    机器人学——2.3-姿态插值和笛卡尔运动
    面向对象
    数组
    变量总结
  • 原文地址:https://www.cnblogs.com/jdbc2nju/p/7364648.html
Copyright © 2011-2022 走看看