python3 面向?qū)ο骭_類的內(nèi)置屬性與方法的實(shí)例代碼
0.object類源碼
class object: """ The most base type """ def __delattr__(self, *args, **kwargs): # real signature unknown """ Implement delattr(self, name). """ pass def __dir__(self): # real signature unknown; restored from __doc__ """ __dir__() -> list default dir() implementation """ return [] def __eq__(self, *args, **kwargs): # real signature unknown """ Return self==value. """ pass def __format__(self, *args, **kwargs): # real signature unknown """ default object formatter """ pass def __getattribute__(self, *args, **kwargs): # real signature unknown """ Return getattr(self, name). """ pass def __ge__(self, *args, **kwargs): # real signature unknown """ Return self>=value. """ pass def __gt__(self, *args, **kwargs): # real signature unknown """ Return self>value. """ pass def __hash__(self, *args, **kwargs): # real signature unknown """ Return hash(self). """ pass def __init_subclass__(self, *args, **kwargs): # real signature unknown """ This method is called when a class is subclassed. The default implementation does nothing. It may be overridden to extend subclasses. """ pass def __init__(self): # known special case of object.__init__ """ Initialize self. See help(type(self)) for accurate signature. """ pass def __le__(self, *args, **kwargs): # real signature unknown """ Return self<=value. """ pass def __lt__(self, *args, **kwargs): # real signature unknown """ Return self<value. """ pass @staticmethod # known case of __new__ def __new__(cls, *more): # known special case of object.__new__ """ Create and return a new object. See help(type) for accurate signature. """ pass def __ne__(self, *args, **kwargs): # real signature unknown """ Return self!=value. """ pass def __reduce_ex__(self, *args, **kwargs): # real signature unknown """ helper for pickle """ pass def __reduce__(self, *args, **kwargs): # real signature unknown """ helper for pickle """ pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass def __setattr__(self, *args, **kwargs): # real signature unknown """ Implement setattr(self, name, value). """ pass def __sizeof__(self): # real signature unknown; restored from __doc__ """ __sizeof__() -> int size of object in memory, in bytes """ return 0 def __str__(self, *args, **kwargs): # real signature unknown """ Return str(self). """ pass @classmethod # known case def __subclasshook__(cls, subclass): # known special case of object.__subclasshook__ """ Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached). """ pass __class__ = None # (!) forward: type, real value is '' __dict__ = {} __doc__ = '' __module__ = ''
1.內(nèi)置屬性說明
①__class__:說明對(duì)象處于模塊中的哪一個(gè)類
②[類名].__dict__:打印類的所有屬性與方法(包括繼承自基類的屬性和方法)(包括內(nèi)置屬性和方法)
[對(duì)象].__dict__:打印對(duì)象的所有屬性(私有和公有)
總結(jié)
以上所述是小編給大家介紹的python3 面向?qū)ο骭_類的內(nèi)置屬性與方法的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- Python使用內(nèi)置函數(shù)setattr設(shè)置對(duì)象的屬性值
- Python List列表對(duì)象內(nèi)置方法實(shí)例詳解
- Python序列對(duì)象與String類型內(nèi)置方法詳解
- Python面向?qū)ο笾惖膬?nèi)置attr屬性示例
- Python統(tǒng)計(jì)可散列的對(duì)象之容器Counter詳解
- Python面向?qū)ο蠓庋b繼承和多態(tài)示例講解
- python學(xué)習(xí)之可迭代對(duì)象、迭代器、生成器
- Python解析JSON對(duì)象的全過程記錄
- Python中對(duì)象的比較操作==和is區(qū)別詳析
- 淺談Python中的常用內(nèi)置對(duì)象
相關(guān)文章
scrapy redis配置文件setting參數(shù)詳解
這篇文章主要介紹了scrapy redis配置文件setting參數(shù)詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-11-11python自動(dòng)定時(shí)任務(wù)schedule庫(kù)的使用方法
當(dāng)你需要在 Python 中定期執(zhí)行任務(wù)時(shí),schedule 庫(kù)是一個(gè)非常實(shí)用的工具,它可以幫助你自動(dòng)化定時(shí)任務(wù),本文給大家介紹了python自動(dòng)定時(shí)任務(wù)schedule庫(kù)的使用方法,需要的朋友可以參考下2024-02-02如何用Python來理一理紅樓夢(mèng)里的那些關(guān)系
這篇文章主要介紹了用Python來理一理紅樓夢(mèng)里的那些關(guān)系代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08Python的pywifi無線網(wǎng)絡(luò)庫(kù)的具體使用
pywifi是一個(gè)基于Python的用于操作無線網(wǎng)絡(luò)的庫(kù),本文就來介紹一下pywifi的安裝及實(shí)際應(yīng)用場(chǎng)景使用,具有一定的參考價(jià)值,感興趣的可以了解一下2024-02-02關(guān)于命令行執(zhí)行Python腳本的傳參方式
這篇文章主要介紹了關(guān)于命令行執(zhí)行Python腳本的傳參方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09詳解Python對(duì)某地區(qū)二手房房?jī)r(jià)數(shù)據(jù)分析
這篇文章主要為大家介紹了Python數(shù)據(jù)分析某地區(qū)二手房房?jī)r(jià),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助2021-12-12對(duì)Python中數(shù)組的幾種使用方法總結(jié)
今天小編就為大家分享一篇對(duì)Python中數(shù)組的幾種使用方法總結(jié),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-06-06Python優(yōu)化列表接口進(jìn)行分頁示例實(shí)現(xiàn)
最近,在做測(cè)試開發(fā)平臺(tái)的時(shí)候,需要對(duì)測(cè)試用例的列表進(jìn)行后端分頁,在實(shí)際去寫代碼和測(cè)試的過程中,發(fā)現(xiàn)這里面還是有些細(xì)節(jié)的,故想復(fù)盤一下2021-09-09