Python 注释,类,属性,方法,继承
# coding=utf-8 支持中文
"""
多行注释
声明鸟类
"""
class Bird(object):
have_feather = True
way_of_reproduction = 'egg'
# 类内功能模块空一行
@staticmethod
def move(x, y):
position = [0, 0]
position[0] = position[0] + x
position[1] = position[1] + y
return position
# 类,功能块空两行
class Chicken(Bird):
way_of_move = 'walk'
summer = Bird()
print summer.way_of_reproduction
print summer.move(10, 20)
chicken = Chicken()
print chicken.way_of_move
print chicken.way_of_reproduction
空行,规范很烦躁。