python3 面向对象__类的内置属性与方法的实例代码
程序员文章站
2023-10-31 15:30:10
0.object类源码
class object:
""" the most base type """
def __delattr__(self,...
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.内置属性说明
①__class__:说明对象处于模块中的哪一个类
②[类名].__dict__:打印类的所有属性与方法(包括继承自基类的属性和方法)(包括内置属性和方法)
[对象].__dict__:打印对象的所有属性(私有和公有)
总结
以上所述是小编给大家介绍的python3 面向对象__类的内置属性与方法的实例代码,希望对大家有所帮助
推荐阅读
-
Python面向对象程序设计中类的定义、实例化、封装及私有变量/方法详解
-
python3 面向对象__类的内置属性与方法的实例代码
-
php面向对象中static静态属性与方法的内存位置分析
-
JavaScript面向对象学习之类的创建,类的抽象代码实例讲解
-
JavaScript-类的定义与对象的创建代码实例
-
JAVA 基础 /第七课: 面向对象 / JAVA类的属性,类变量与实例变量
-
举例讲解Python面相对象编程中对象的属性与类的方法
-
Ruby面向对象编程中类与方法的基础学习
-
Java构造方法,封装类,this用法,面向对象思想的综合运用(代码附详细注解)
-
Ruby面向对象编程中类的方法与类的扩展