zoukankan      html  css  js  c++  java
  • 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
    
    

    空行,规范很烦躁。

  • 相关阅读:
    POST
    界面,数据下载
    异步下载
    Cell
    循环&信息添加&颜色修改
    通讯录
    图片循环
    多删搜索
    图片滚动
    TableView
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/10590179.html
Copyright © 2011-2022 走看看