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. Java 学习路线建议

    在大家看之前,我要先声明两点.1.由于我本人是Java后端开发出身,因此所推荐的学习内容是Java Web和Java后端开发的路线,非Java Web和Java后端开发的同学请适当参考其学习思想即可, ...

  2. vue 子组件 索引 ref

    尽管有props和events,但是有时任然需要在javascript中直接访问子组件.为此可是使用ref为子组件指定一个索引ID. <div id="parent"> ...

  3. Gym 100531J Joy of Flight (几何)

    题意:你从开始坐标到末尾坐标,要经过 k 秒,然后给你每秒的风向,和飞机的最大速度,问能不能从开始到末尾. 析:首先这个风向是不确定的,所以我们先排除风向的影响,然后算出,静风是的最小速度,如果这都大 ...

  4. ASP.NET Core MVC 打造一个简单的图书馆管理系统 (修正版)(四)图书信息的增删改查

    前言: 本系列文章主要为我之前所学知识的一次微小的实践,以我学校图书馆管理系统为雏形所作. 本系列文章主要参考资料: 微软文档:https://docs.microsoft.com/zh-cn/asp ...

  5. idea 快捷键以及包含字符串文件搜索

    1.idea也有一个类似于eclipse的包含字符串文件搜索(特别实用) idea 里按快捷键:ctrl+H 2.下图是idea的快捷键汇总 3.debug调试 F5:跳入方法   F6:向下逐行调试 ...

  6. vscode等编辑器正则一键剔除注释的方法

    匹配HTML单行注释: <!--(.*?)--> 匹配HTML多行注释: <!--([\s\S|\r]*?)--> 或者: <!--([\w\W]*?)--> 除了 ...

  7. poj 3164 Command Network (朱刘算法)

    题目链接: http://poj.org/problem?id=3164 题目大意: 有n个点(用坐标表示)各点编号分别为1—>n,m条单向路,问能否存在一个花费价值最小的网络,能使从1点到达任 ...

  8. 题解报告:hdu 1160 FatMouse's Speed(LIS+记录路径)

    Problem Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove th ...

  9. FileStream和BinaryReader,BinaryWriter,StreamReader,StreamWriter的区别

    FileStream对于在文件系统上读取和写入文件非常有用,FileStream缓存输入和输出,以获得更好的性能.FileStream对象表示在磁盘或网络路径上指向文件的流.这个类提供了在文件中读写字 ...

  10. oracle (DBaaS) 服务介绍

    转 https://oracle-base.com/articles/vm/oracle-cloud-database-as-a-service-dbaas-create-service?utm_so ...