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!

  • 相关阅读:
    js 闭包
    js 图片放大镜功能
    前端页面优化
    css 背景图片自适应分辨率大小 兼容
    纯css实现箭头
    js 排序算法
    css3 渐变 兼容
    css 兼容性总结
    css3 @keyframe 抖动/变色动画
    关于$.data(element,key,value)与ele.data.(key,value)的区别
  • 原文地址:https://www.cnblogs.com/jdbc2nju/p/7364648.html
Copyright © 2011-2022 走看看