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


Posted in Python onNovember 09, 2018

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 相关文章推荐
python获取局域网占带宽最大3个ip的方法
Jul 09 Python
Python制作简易注册登录系统
Dec 15 Python
Python实现线程状态监测简单示例
Mar 28 Python
Python 脚本获取ES 存储容量的实例
Dec 27 Python
Python 互换字典的键值对实例
Feb 12 Python
Python中的类与类型示例详解
Jul 10 Python
Python的bit_length函数来二进制的位数方法
Aug 27 Python
Python如何向SQLServer存储二进制图片
Jun 08 Python
python缺失值的解决方法总结
Jun 09 Python
python非标准时间的转换
Jul 25 Python
Python 数据可视化之Bokeh详解
Nov 02 Python
Django基础CBV装饰器和中间件
Mar 22 Python
python 不同方式读取文件速度不同的实例
Nov 09 #Python
对python多线程与global变量详解
Nov 09 #Python
python 多线程中子线程和主线程相互通信方法
Nov 09 #Python
Python文件循环写入行时防止覆盖的解决方法
Nov 09 #Python
对python cv2批量灰度图片并保存的实例讲解
Nov 09 #Python
python进阶之多线程对同一个全局变量的处理方法
Nov 09 #Python
python 多线程将大文件分开下载后在合并的实例
Nov 09 #Python
You might like
简单的过滤字符串中的HTML标记
2006/12/25 PHP
用ADODB来让PHP操作ACCESS数据库的方法
2006/12/31 PHP
PHP生成月历代码
2007/06/14 PHP
一篇有意思的技术文章php介绍篇
2010/10/26 PHP
PHP实现仿Google分页效果的分页函数
2015/07/29 PHP
微信公众号开发客服接口实例代码
2016/10/21 PHP
Yii框架引用插件和ckeditor中body与P标签去除的方法
2017/01/19 PHP
PHP多进程之pcntl_fork的实例详解
2017/10/15 PHP
JS 拼图游戏 面向对象,注释完整。
2009/06/18 Javascript
基于jquery用于查询操作的实现代码
2010/05/10 Javascript
快速查找数组中的某个元素并返回下标示例
2013/09/03 Javascript
JS 实现导航栏悬停效果(续)
2013/09/24 Javascript
display和visibility的区别示例介绍
2014/02/26 Javascript
jquery中change()用法实例分析
2015/02/06 Javascript
如何在Linux上安装Node.js
2016/04/01 Javascript
AngularJS控制器controller给模型数据赋初始值的方法
2017/01/04 Javascript
AngularJS中控制器函数的定义与使用方法示例
2017/10/10 Javascript
vue-auto-focus: 控制自动聚焦行为的 vue 指令方法
2018/08/25 Javascript
JS实现的简单tab切换功能完整示例
2019/06/20 Javascript
IE11下处理Promise及Vue的单项数据流问题
2019/07/24 Javascript
Vue 实现CLI 3.0 + momentjs + lodash打包时优化
2019/11/13 Javascript
Python HTML解析器BeautifulSoup用法实例详解【爬虫解析器】
2019/04/05 Python
python实现猜数游戏(保存游戏记录)
2020/06/22 Python
Django静态文件加载失败解决方案
2020/08/26 Python
css3实现动画的三种方式
2020/08/24 HTML / CSS
HTML5+lufylegend实现游戏中的卷轴
2016/02/29 HTML / CSS
英国珠宝网站Argento: PANDORA、Olivia Burton和Nomination等
2020/05/08 全球购物
应届优秀本科大学毕业生自我鉴定
2014/01/21 职场文书
房屋买卖协议书范本
2014/04/10 职场文书
激励员工的口号
2014/06/16 职场文书
党的群众路线对照检查材料
2014/08/27 职场文书
教师政风行风自查自纠报告
2014/10/21 职场文书
医生见习报告范文
2014/11/03 职场文书
爱心捐款活动总结
2015/05/09 职场文书
Flask搭建一个API服务器的步骤
2021/05/28 Python
一文教你快速生成MySQL数据库关系图
2022/06/28 Redis