码迷,mamicode.com
首页 > 其他好文 > 详细

pep8摘要

时间:2017-09-05 19:13:07      阅读:368      评论:0      收藏:0      [点我收藏+]

标签:print   prefix   nbsp   driver   dev   sep   add   diff   val   

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

#!/usr/bin/python
# -*- coding:utf-8 -*-

# @filename: pep_summary
# @author:wwx399777 wuweiji
# @date: 2017/9/5 8:45

# Start at 5th Sep 2017
# Change at 6th Sep 2017 add Class and function summary


import os
import sys
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[2:10:2]
print slice_content
length_con = len(content)
a, b, c = "", None, None

if 72 < length_con <= 120:
    if content == "this" and length_con == 80:
        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 = 1, 2, 1
if aa == 1 and bb == 2:
    print "‘and‘ is logic operation, 1 treat as decimal 1"
if aa == 1 & cc == 1:
    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


# Dont use spaces around the "=" when used to indicate a keyword argument or a default parameter value
def func(default_para1=1, para2=None):
    return func(1, None)


def func(default_para1=1, para2=None):
    return func(1, None)


class Class_(TypeError):
    def __init__(self, para1, ):
        self.para1 = para1

    def class_func1(self, para_f1,):
        para_f1 = self.para1
        return para_f1

    def class_func1(self, para_f1, ):
        para_f1 = self.para1


# name suffix or prefix with double "__" single "_"

 

pep8摘要

标签:print   prefix   nbsp   driver   dev   sep   add   diff   val   

原文地址:http://www.cnblogs.com/vickey-wu/p/7479953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!