当前位置:主页 > python教程 > python3面向对象类的内置属性与方法的实例

浅析python3面向对象类的内置属性与方法

发布:2019-06-19 15:57:15 101


给网友朋友们带来一篇相关的编程文章,网友朱宜欣根据主题投稿了本篇教程内容,涉及到python3、面向对象、python3、类的内置属性、python3面向对象类的内置属性与方法的实例相关内容,已被835网友关注,下面的电子资料对本篇知识点有更加详尽的解释。

python3面向对象类的内置属性与方法的实例

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 log10()函数简单用法

    发布:2022-12-03

    给大家整理了关于Python3的教程,在本文中我们给大家整理了关于Python3中log10()函数的基本用法和相关知识点,需要的可以学习下。


  • python3.6如何导入excel里面的数据

    python3.6如何导入excel里面的数据

    发布:2022-09-13

    为网友们分享了关于python3的教程,导入包xlrd模块(先确定python是否安装了xlrd模块),处理数据(获取当前表,并选择表1,或者你改的任何一个名字),处理数据(从表中读取数据,并获取表中数据的行和列),输出数据(pr


  • Python3.6及TensorFlow的安装和配置流程(图解)

    发布:2018-09-19

    这篇文章主要为大家详细介绍了python3.6.3及TensorFlow安装配置方法图文教程,具有一定的参考价值,感兴趣的读者们可以参考一下


  • Python3导入CSV文件的实例(跟Python2有些许的不同)

    发布:2022-04-19

    今天小编就为大家分享一篇Python3导入CSV文件的实例(跟Python2有些许的不同),具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧


  • python3 cookbook中常遇问题解答

    发布:2023-04-17

    本文主要介绍了python3 cookbook中常遇问题解答,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧


  • Python面向对象class类属性及子类用法分析

    发布:2022-04-10

    这篇文章主要介绍了Python面向对象class类属性及子类用法,结合实例形式较为详细的分析了Python面向对象编程中class类属性的访问、修改、删除操作及子类的相关使用技巧,需要的朋友可以参考下


  • python3爬取TOP500的音乐信息的代码详解

    发布:2020-02-04

    今天小编就为大家分享一篇python3 实现爬取TOP500的音乐信息并存储到mongoDB数据库中,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧


  • Linux CentOS7下安装python3的步骤详解

    发布:2019-11-22

    在CentOS7下,默认安装的就是python2.7,下面通过本文给大家分享Linux CentOS7下安装python3 的方法,需要的朋友参考下吧


网友讨论