https://www.python.org/dev/peps/pep-0008/

#!/usr/bin/python
# -*- coding:utf- -*- # @filename: pep_summary
# @author:vickey wu
# @date: // : # Start at 5th Sep
# Change at 6th Sep add Class and function summary import os
import sys
from time import *
from subprocess import Popen, PIPE
from selenium.webdriver.support.wait import WebDriverWait # long content cut to two or more part with "\"
content = "this is a very long long long long long long long long long content long \
content"
slice_content = content[::]
print slice_content
length_con = len(content)
a, b, c = "", None, None if < length_con <= :
if content == "this" and length_con == :
length_con = (length_con
+ length_con
+ length_con
+ length_con)
print length_con # different between "is" and "=="
if b is not c:
print "different object"
else:
print "same object"
if a == c:
print "same value"
else:
print "different value" # different between "and" and "&"
aa, bb, cc = , ,
if aa == and bb == :
print "'and' is logic operation, 1 treat as decimal 1"
if aa == & cc == :
print "'&' is bitwise operation, 1 treat as binary 01"
else:
print "different" try:
aa == bb
except Exception as e:
print "aa is not equal to bb" # add whitespace at the lowest priorities
i = aa + bb
ii = (aa + bb) + aa * (bb + cc) + aa - bb # Don't use spaces around the "=" when used to indicate a keyword argument or a default parameter value
def func(default_para1=, para2=None):
"""
:param default_para1:
:param para2:
:return:
"""
return func(, None) def funct(default_para1=, para2=None):
return func(, None) class ClassA(object):
"""
:param object
""" def __init__(self, para_a=None):
self.para_b = para_a def get(self):
"""
None
:return:
"""
para2 = self.para1
return para2 def _func(self):
"""
__ two underline in the beginning mean the goal here is to avoid your method to be overridden by a subclass
:param args:
:param kwargs:
:return:
"""
return self.para_b class ClassB(ClassA):
"""
This Class used to practice pep8 regulation
""" def __init__(self, para1=None, para2=None, para3=None):
super(ClassA, self).__init__(para1, para2)
self.para3 = para3 def class_func1(self):
para4 = self.para1 + self.para2
if para4 is not None:
return para4 def _private_func(self):
"""
_ one underline in the beginning mean private method or attribute, you shouldn't access it
:param para_f1:
:return:
""" self._para_f1 = self.para1 return self._para_f1 def class_func2(self):
# override class method
return self.para_b def __new__(cls, *args, **kwargs):
"""
__ two underline in the beginning and in the end it means it's a method python calls, not you
:param args:
:param kwargs:
:return:
""" pass # name suffix or prefix with double "__" or single "_".
# one underline in the beginning indicate this method or attribute is private
# which mean other method can\'t call it. # one underline in the end avoid name is conflict with keyword.
# two underline in the beginning to avoid your class method be overridden by subclass.
# two underline in the beginning and in the end means it's a method python calls, not you. # Use _one_underline to mark you methods as not part of the API. Use __two_underlines__
# when you're creating objects to look like native python objects
# or you wan't to customize behavior in specific situations.
# And don't use __just_two_underlines, unless you really know what you're doing b = ClassB(object)
a = ClassA(object)
# b.
    

pep8摘要的更多相关文章

  1. python代码风格指南:pep8 中文翻译

    摘要 本文给出主Python版本标准库的编码约定.CPython的C代码风格参见​PEP7.本文和​PEP 257 文档字符串标准改编自Guido最初的<Python Style Guide&g ...

  2. java根据html生成摘要

    转自:http://java.freesion.com/article/48772295755/ 开发一个系统,需要用到这个,根据html生成你指定多少位的摘要 package com.chendao ...

  3. Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结

    Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...

  4. 2、摘要函数——MD2/MD4/MD5数字签名

    摘要是用来防止数据被私自改动的方法,其中用到的函数叫做摘要函数.这些函数的输入可以是任意大小的信息,但是输出是大小固定的摘要.摘要有个重要的特性:如果改变了输入信息的任何内容,即使改变一位,输出也将发 ...

  5. 前端学HTTP之摘要认证

    前面的话 上一篇介绍的基本认证便捷灵活,但极不安全.用户名和密码都是以明文形式传送的,也没有采取任何措施防止对报文的篡改.安全使用基本认证的唯一方式就是将其与SSL配合使用 摘要认证与基本认证兼容,但 ...

  6. Java 消息摘要 散列 MD5 SHA

    package xxx.common.util; import java.math.BigInteger; import java.security.MessageDigest; import jav ...

  7. rpm查询命令摘要

    任务 命令 显示软件包的相关信息 rpm -q -i NAME 列出软件包中含有的所有文件 rpm -q -i NAME 列出软件包中含有的配置文件 rpm -q -c NAME 列出软件包中含有的文 ...

  8. [Java 安全]消息摘要与数字签名

    消息摘要 算法简述 定义 它是一个唯一对应一个消息或文本的固定长度的值,它由一个单向Hash加密函数对消息进行作用而产生.如果消息在途中改变了,则接收者通过对收到消息的新产生的摘要与原摘要比较,就可知 ...

  9. HMAC加密的消息摘要码

    HMAC(Hash Message Authentication Code)哈希消息授权码,它在消息摘要算法(例如MD5,SHA系列算法)的基础上,使用密钥对消息摘要进行加密.它相当于一个马甲,内里可 ...

随机推荐

  1. AutoIT: GUISetFont VS GUICtrlSetFont

    GUISetFont 可以设置默认字体,后面的资源都会用该字体,而 GUICtrlSetFont 可以对特定控件的字体进行设置. ;Combo,setfont, GUICtrlSetFont $fon ...

  2. C++实现二叉树(建树,前序,中序,后序)递归和非递归实现

    #include<iostream> #include<string.h> #include<stack> using namespace std; typedef ...

  3. error C2664: “CWnd::MessageBoxW”: 不能将参数 1 从“const char [17]”转换为“LPCTSTR”

    vs2008提示 error C2664: “CWnd::MessageBoxW”: 不能将参数 1 从“const char [17]”转换为“LPCTSTR” 在外面用vs2005编写mfc程序的 ...

  4. Swift4 内存管理, 可选链, KeyPath

    创建: 2018/03/09 完成: 2018/03/09 参照型数据与ARC  ARC ● Swift里, 只有类实例与闭包实例是参照型 ● 生成时参照值为1, 被代入等每次+1, 减少每次-1 ● ...

  5. JAVA 添加、修改和删除PDF书签

    当阅读篇幅较长的PDF文档时,为方便我们再次阅读时快速定位到上一次的阅读位置,可以插入一个书签进行标记:此外,对于文档中已有的书签,我们也可以根据需要进行修改或者删除等操作.本篇文章将通过Java编程 ...

  6. 30行JavaScript代码实现一个比特币量化策略

    精简极致的均线策略 30行打造一个正向收益系统 原帖地址:https://www.fmz.com/bbs-topic-new/262 没错!你听的没错是30行代码!仅仅30行小编我习惯先通篇来看看 代 ...

  7. 关于浮动与清浮动 float

    浮动常见的几种属性值 float {left;  right;  none;  } 主要是定义元素朝哪个方向浮动: 元素浮动后的特性 在一行显示,父级的宽度放不下,自己折行: 支持宽高等样式: 不设置 ...

  8. docker 中部署一个springBoot项目

    docker 中部署一个springBoot项目 (1)介绍 springBoot项目 1.项目结构 2.pom.xml <?xml version="1.0" encodi ...

  9. shell 调试 `<<' is not matched

    我的这段脚本,验证数据库连接是否正常: #! /bin/sh...while ..do....sqlplus $user/ $passwd@$sid  <<!quit;! ... 单独执行 ...

  10. Android开发学习——Volley框架

    转载至: http://blog.csdn.net/guolin_blog/article/details/17482095 一些概念性的东西 大家进入上边链接理解,我贴一下 具体的实现代码: pub ...