| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
 本帖最后由 zyx2012 于 2025-1-27 01:58 编辑  
 
原文: 
- Help on class ArithmeticError in module builtins:
 
  
- class ArithmeticError(Exception)
 
 -  |  Base class for arithmetic errors.
 
 -  |
 
 -  |  Method resolution order:
 
 -  |      ArithmeticError
 
 -  |      Exception
 
 -  |      BaseException
 
 -  |      object
 
 -  |
 
 -  |  Built-in subclasses:
 
 -  |      FloatingPointError
 
 -  |      OverflowError
 
 -  |      ZeroDivisionError
 
 -  |
 
 -  |  Methods defined here:
 
 -  |
 
 -  |  __init__(self, /, *args, **kwargs)
 
 -  |      Initialize self.  See help(type(self)) for accurate signature.
 
 -  |
 
 -  |  ----------------------------------------------------------------------
 
 -  |  Static methods defined here:
 
 -  |
 
 -  |  __new__(*args, **kwargs)
 
 -  |      Create and return a new object.  See help(type) for accurate signature.
 
 -  |
 
 -  |  ----------------------------------------------------------------------
 
 -  |  Methods inherited from BaseException:
 
 -  |
 
 -  |  __getattribute__(self, name, /)
 
 -  |      Return getattr(self, name).
 
 -  |
 
 -  |  __reduce__(self, /)
 
 -  |      Helper for pickle.
 
 -  |
 
 -  |  __repr__(self, /)
 
 -  |      Return repr(self).
 
 -  |
 
 -  |  __setstate__(self, object, /)
 
 -  |
 
 -  |  __str__(self, /)
 
 -  |      Return str(self).
 
 -  |
 
 -  |  add_note(self, object, /)
 
 -  |      Exception.add_note(note) --
 
 -  |      add a note to the exception
 
 -  |
 
 -  |  with_traceback(self, object, /)
 
 -  |      Exception.with_traceback(tb) --
 
 -  |      set self.__traceback__ to tb and return self.
 
 -  |
 
 -  |  ----------------------------------------------------------------------
 
 -  |  Data descriptors inherited from BaseException:
 
 -  |
 
 -  |  __cause__
 
 -  |      exception cause
 
 -  |
 
 -  |  __context__
 
 -  |      exception context
 
 -  |
 
 -  |  __dict__
 
 -  |
 
 -  |  __suppress_context__
 
 -  |
 
 -  |  __traceback__
 
 -  |
 
 -  |  args
 
 
  复制代码 
翻译: 
- 关于模块内置类中 ArithmeticError 的帮助:
 
 - 是算术错误的基类.
 
 - 路径:
 
 -   ArithmeticError
 
 -   Excepion(异常)
 
 -   BaseExcepion(基本异常)
 
 -   object
 
 - 子类:
 
 -   FloatingPointError(浮点溢出)
 
 -   OverflowError(数值溢出)
 
 -   ZeroDivisionError(除数为0)
 
 - 方法:
 
 -   __init__(self, /, *args, **kwargs)
 
 -     初始化.参见help(type(self))
 
 - 静态方法:
 
 -   __new__(*args, **kwargs)
 
 -     创造并返回一个新对象 #这些真的用写吗
 
 - 继承自BaseExcepion的方法:
 
 -   __getattribute__(self, name, /)
 
 -     return getattr(self, name) #详见<<零基础入门学习Python(最新版)>>类和对象第68讲(XI) 网页:https://fishc.com.cn/forum.php?mod=viewthread&tid=215774
 
 -   __reduce__(self, /)
 
 -     pickle的辅助方法  #这个我不知道,放个链接:https://blog.csdn.net/d710055071/article/details/137523603
 
 -   __repr__(self, /)
 
 -     返回repr  #repr() 函数将对象转化为供解释器读取的形式,与str()函数类似,详见第71讲, 链接:https://fishc.com.cn/forum.php?mod=viewthread&tid=216648
 
 -   __setstate__(self, object, /) #pickle.loads(bytes)反序列化时,会调用__setstate__方法,该方法所需参数为序列化时__dict__或__getstate__提供的,前者提供为字典格式,后者提供格式具体看其返回值
 
 -   __str__(self, /)
 
 -     返回str(self)
 
 -   add_note(self, object, /)
 
 -     Exception.add_note(note)
 
 -     为异常添加注释.
 
 -   with_traceback(self, object, /)
 
 -     Exception.with_traceback(tb)
 
 -     将 self.__traceback__ 设为 tb 并返回 self。#就是设置异常的回溯信息
 
 - 从 BaseException 继承的数据描述符:
 
 -   __cause__  #捕获异常
 
 -     异常原因
 
 -   __context__  #个人不太明白这个和__cause__有什么区别, 特请大佬解答
 
 -     异常上下文
 
 -   __dict__  
 
 -   __suppress_context__
 
 -   __traceback__
 
 -   args
 
  复制代码 
啥也不会,只是为了学习......不足之处请指点 
 |   
 
 
 
 |