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二维码生成库qrcode安装和使用示例
Dec 16 Python
python通过wxPython打开一个音频文件并播放的方法
Mar 25 Python
Python中read()、readline()和readlines()三者间的区别和用法
Jul 30 Python
Python MD5加密实例详解
Aug 02 Python
利用Python暴力破解zip文件口令的方法详解
Dec 21 Python
Python使用matplotlib绘制正弦和余弦曲线的方法示例
Jan 06 Python
python文件拆分与重组实例
Dec 10 Python
一篇文章搞懂Python的类与对象名称空间
Dec 10 Python
Jacobi迭代算法的Python实现详解
Jun 29 Python
Python测试模块doctest使用解析
Aug 10 Python
Python urllib库如何添加headers过程解析
Oct 05 Python
七个非常实用的Python工具包总结
Jun 15 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
php中隐形字符65279(utf-8的BOM头)问题
2014/08/16 PHP
php 读写json文件及修改json的方法
2018/03/07 PHP
PHP基于面向对象实现的留言本功能实例
2018/04/04 PHP
开发跨浏览器javascript常见注意事项
2009/01/01 Javascript
script标签属性type与language使用选择
2012/12/02 Javascript
js修改地址栏URL参数解决url参数问题
2012/12/15 Javascript
jquery foreach使用示例
2013/09/12 Javascript
angularJS 中$attrs方法使用指南
2015/02/09 Javascript
使用Bootstrap typeahead插件实现搜索框自动补全的方法
2016/07/07 Javascript
jQuery中animate的几种用法与注意事项
2016/12/12 Javascript
bootstrap日期控件问题(双日期、清空等问题解决)
2017/04/19 Javascript
手把手教你把nodejs部署到linux上跑出hello world
2017/06/19 NodeJs
js比较两个单独的数组或对象是否相等的实例代码
2019/04/28 Javascript
微信小程序蓝牙连接小票打印机实例代码详解
2019/06/03 Javascript
[03:49]DOTA2英雄基础教程 光之守卫
2014/01/14 DOTA
[01:14]2014DOTA2展望TI 剑指西雅图newbee战队专访
2014/06/30 DOTA
python调用cmd命令行制作刷博器
2014/01/13 Python
python将字符串转换成数组的方法
2015/04/29 Python
老生常谈python之鸭子类和多态
2017/06/13 Python
Python读csv文件去掉一列后再写入新的文件实例
2017/12/28 Python
Python2和Python3中urllib库中urlencode的使用注意事项
2018/11/26 Python
对python pandas读取剪贴板内容的方法详解
2019/01/24 Python
pyqt5 键盘监听按下enter 就登陆的实例
2019/06/25 Python
python-opencv获取二值图像轮廓及中心点坐标的代码
2019/08/27 Python
解决pycharm每次打开项目都需要配置解释器和安装库问题
2020/02/26 Python
PyCharm Anaconda配置PyQt5开发环境及创建项目的教程详解
2020/03/24 Python
纽约著名的服装辅料来源:M&J Trimming
2017/07/26 全球购物
巴西购物网站:Onofre Agora
2020/06/08 全球购物
shell程序中如何注释
2012/01/28 面试题
Linux的文件类型
2012/03/07 面试题
破坏寝室公物检讨书
2014/11/17 职场文书
2014年评职称工作总结
2014/11/20 职场文书
整改通知书格式
2015/04/22 职场文书
信访维稳承诺书
2015/05/04 职场文书
2016高考冲刺决心书
2015/09/23 职场文书
MySQL库表名大小写的选择
2021/06/05 MySQL