<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        python函數-classmethod()

        來源:懂視網 責編:小采 時間:2020-11-27 14:28:39
        文檔

        python函數-classmethod()

        python函數-classmethod():classmethod(function)中文說明:classmethod是用來指定一個類的方法為類方法,沒有此參數指定的類的方法為實例方法,使用方法如下:class C: @classmethod def f(cls, arg1, arg2, ...): ... 類方法既可以直接類調用(C.f()),也可以進行
        推薦度:
        導讀python函數-classmethod():classmethod(function)中文說明:classmethod是用來指定一個類的方法為類方法,沒有此參數指定的類的方法為實例方法,使用方法如下:class C: @classmethod def f(cls, arg1, arg2, ...): ... 類方法既可以直接類調用(C.f()),也可以進行

        classmethod(function)

        中文說明:

        classmethod是用來指定一個類的方法為類方法,沒有此參數指定的類的方法為實例方法,使用方法如下:

        class C:
         @classmethod
         def f(cls, arg1, arg2, ...): ...

        類方法既可以直接類調用(C.f()),也可以進行實例調用(C().f())。

        版本:python2.2中新增,在python2.4中增加新功能。python3中仍可用。

        英文說明:

        Return a class method for function.

        A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

        class C:
         @classmethod
         def f(cls, arg1, arg2, ...): ...

        The @classmethod form is a function decorator – see the description of function definitions in Function definitions for details.

        It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

        Class methods are different than C++ or Java static methods. If you want those, see staticmethod() in this section.

        For more information on class methods, consult the documentation on the standard type hierarchy in The standard type hierarchy.

        New in version 2.2.

        Changed in version 2.4: Function decorator syntax added.

        代碼實例:

        >>> class C:
        ... @classmethod
        ... def f(self):
        ... print "This is a class method"
        ...
        >>> C.f()
        This is a class method
        >>> c = C()
        >>> c.f()
        This is a class method
        >>> class D:
        ... def f(self):
        ... print " This is not a class method "
        ...
        >>> D.f()
        Traceback (most recent call last):
         File "", line 1, in 
        TypeError: unbound method f() must be called with D instance as first argument (got nothing instead)
        >>> d = D()
        >>> d.f()
        This is not a class method

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        python函數-classmethod()

        python函數-classmethod():classmethod(function)中文說明:classmethod是用來指定一個類的方法為類方法,沒有此參數指定的類的方法為實例方法,使用方法如下:class C: @classmethod def f(cls, arg1, arg2, ...): ... 類方法既可以直接類調用(C.f()),也可以進行
        推薦度:
        標簽: 函數 python class
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲无线观看国产精品| 午夜一区二区免费视频| 免费A级毛片无码A| 亚洲国产精品18久久久久久| 在线视频观看免费视频18| 亚洲中字慕日产2021| 国产情侣激情在线视频免费看| 亚洲性色成人av天堂| 免费看男女下面日出水来| 亚洲福利视频一区二区三区| 3d成人免费动漫在线观看| 亚洲国产成人久久| 中字幕视频在线永久在线观看免费 | 国产猛烈高潮尖叫视频免费| 亚洲av第一网站久章草| 免费一看一级毛片全播放| 色多多www视频在线观看免费| 超清首页国产亚洲丝袜| 国产午夜成人免费看片无遮挡| 亚洲AV本道一区二区三区四区| 曰批全过程免费视频播放网站 | 国产亚洲精品a在线观看| eeuss影院www天堂免费| 亚洲成A人片在线观看WWW| 999任你躁在线精品免费不卡| 亚洲人成网站看在线播放| 国产禁女女网站免费看| 久久嫩草影院免费看夜色| 亚洲av色福利天堂| 中文字幕无码免费久久99| 一级人做人a爰免费视频| 亚洲国产精品特色大片观看完整版 | 99久久精品日本一区二区免费| 亚洲A∨精品一区二区三区下载| 亚洲精品专区在线观看| 亚洲欧洲免费视频| 亚洲大尺度无码无码专线一区| 中文字幕亚洲第一| 成年性午夜免费视频网站不卡| 一级做a爰片性色毛片免费网站| 亚洲AV无码专区国产乱码电影|