亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

Python編程規范-命名和文檔字符串

系統 2237 0

目錄

命名規范

Google開發規范

函數

PEP8

函數


命名規范

Python編程規范-命名和文檔字符串_第1張圖片

Google開發規范

函數

Args:

列出每個參數的名字, 并在名字后使用一個冒號和一個空格, 分隔對該參數的描述.如果描述太長超過了單行80字符,使用2或者4個空格的懸掛縮進(與文件其他部分保持一致). 描述應該包括所需的類型和含義. 如果一個函數接受*foo(可變長度參數列表)或者**bar (任意關鍵字參數), 應該詳細列出*foo和**bar.

Returns: (或者 Yields: 用于生成器)

描述返回值的類型和語義. 如果函數返回None, 這一部分可以省略.

Raises:

列出與接口有關的所有異常.

            
              def fetch_bigtable_rows(big_table, keys, other_silly_variable=None):
    """Fetches rows from a Bigtable.

    Retrieves rows pertaining to the given keys from the Table instance
    represented by big_table.  Silly things may happen if
    other_silly_variable is not None.

    Args:
        big_table: An open Bigtable Table instance.
        keys: A sequence of strings representing the key of each table row
            to fetch.
        other_silly_variable: Another optional variable, that has a much
            longer name than the other args, and which does nothing.

    Returns:
        A dict mapping keys to the corresponding table row data
        fetched. Each row is represented as a tuple of strings. For
        example:

        {'Serak': ('Rigel VII', 'Preparer'),
         'Zim': ('Irk', 'Invader'),
         'Lrrr': ('Omicron Persei 8', 'Emperor')}

        If a key from the keys argument is missing from the dictionary,
        then that row was not found in the table.

    Raises:
        IOError: An error occurred accessing the bigtable.Table object.
    """
    pass
            
          

            
              class SampleClass(object):
    """Summary of class here.

    Longer class information....
    Longer class information....

    Attributes:
        likes_spam: A boolean indicating if we like SPAM or not.
        eggs: An integer count of the eggs we have laid.
    """

    def __init__(self, likes_spam=False):
        """Inits SampleClass with blah."""
        self.likes_spam = likes_spam
        self.eggs = 0

    def public_method(self):
        """Performs operation blah."""
            
          

            
              # We use a weighted dictionary search to find out where i is in
# the array.  We extrapolate position based on the largest num
# in the array and the array size and then do binary search to
# get the exact number.

if i & (i-1) == 0:        # true iff i is a power of 2
            
          

PEP8

            
              class HTTPAdapter(BaseAdapter):
    """The built-in HTTP Adapter for urllib3.

    Provides a general-case interface for Requests sessions to contact HTTP and
    HTTPS urls by implementing the Transport Adapter interface.

    :param pool_connections: The number of urllib3 connection pools to cache.
    :param max_retries: The maximum number of retries each connection
        should attempt.

    Usage::

      >>> import requests
      >>> s = requests.Session()
      >>> a = requests.adapters.HTTPAdapter(max_retries=3)
      >>> s.mount('http://', a)
    """
   
    def __init__(self, pool_connections, max_retries):
        self.pool_connections = pool_connections
        self.max_retries = max_retries
            
          

函數

            
              def simple_func(method, timeout)
    """Constructs and sends a :class:`Request 
              
                `.
    
    :param method: method for the new :class:`Request` object.
    :param timeout: (optional) How many seconds to wait for the server to send data
        before giving up, as a float, or a :ref:`(connect timeout, read
        timeout) 
                
                  ` tuple.
    :type timeout: float or tuple
    :return: :class:`Response 
                  
                    ` object
    :rtype: requests.Response
    
    Usage::
    
      >>> import requests
      >>> req = requests.request('GET', 'http://httpbin.org/get')
      
                    
                      
    """
                    
                  
                
              
            
          

            
              # We use a weighted dictionary search to find out where i is in
# the array.  We extrapolate position based on the largest num
# in the array and the array size and then do binary search to
# get the exact number.

if i & (i-1) == 0:        # true iff i is a power of 2
            
          

?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲欧美韩日 | 丰满放荡岳乱妇91www | 九九精品免视看国产成人 | 精品午夜寂寞影院在线观看 | 国产精品午夜高清在线观看 | 欧美亚洲三级 | 亚洲春色综合另类网蜜桃 | 成人亚洲欧美综合 | 国产亚洲午夜精品 | 国产视频日本 | 国产亚洲一区呦系列 | 免费精品美女久久久久久久久 | 伊人狠狠丁香婷婷综合色 | 国产97色在线 | 亚洲 | 成年女人毛片免费播放人 | 精品久久久中文字幕一区 | 亚洲色视频在线播放网站 | 亚洲成人在线视频观看 | 天天色天天射综合网 | 精品一区精品二区 | 噜噜色噜噜色 | 国产高清视频在线免费观看 | 老司机成人午夜精品福利视频 | 日韩精品一二三区 | 波多野结衣一二区 | 国产成人精品久久免费动漫 | 精品综合一区二区三区 | 337p欧美超大胆日本人术艺术 | 在线观看中文字幕第一页 | 欧美高清亚洲欧美一区h | 曰本色wa | 日韩一级视频免费观看 | 亚洲天天网综合自拍图片专区 | 久夜色精品国产一区二区三区 | 性生活一级毛片 | 天堂一区二区三区在线观看 | 国产在线拍揄自揄视频不卡99 | 成人在线免费 | 国产牛牛 | 亚洲国产一区二区a毛片 | 日本一区不卡视频 |