6060"""
6161
6262class Exception :
63+ """Proposed base class for all exceptions."""
6364 def __init__ (self , * args ):
6465 self .args = args
6566
@@ -75,9 +76,11 @@ def __getitem__(self, i):
7576 return self .args [i ]
7677
7778class StandardError (Exception ):
79+ """Base class for all standard Python exceptions."""
7880 pass
7981
8082class SyntaxError (StandardError ):
83+ """Invalid syntax."""
8184 filename = lineno = offset = text = None
8285 msg = ""
8386 def __init__ (self , * args ):
@@ -94,8 +97,7 @@ def __str__(self):
9497 return str (self .msg )
9598
9699class EnvironmentError (StandardError ):
97- """Base class for exceptions that occur outside the Python system.
98- Primarily used as a base class for OSError and IOError."""
100+ """Base class for I/O related errors."""
99101 def __init__ (self , * args ):
100102 self .args = args
101103 self .errno = None
@@ -126,70 +128,94 @@ def __str__(self):
126128 return StandardError .__str__ (self )
127129
128130class IOError (EnvironmentError ):
131+ """I/O operation failed."""
129132 pass
130133
131134class OSError (EnvironmentError ):
132- """Used by the posix module ."""
135+ """OS system call failed ."""
133136 pass
134137
135138class RuntimeError (StandardError ):
139+ """Unspecified run-time error."""
136140 pass
137141
138142class NotImplementedError (RuntimeError ):
143+ """Method or function hasn't been implemented yet."""
139144 pass
140145
141146class SystemError (StandardError ):
147+ """Internal error in the Python interpreter.
148+
149+ Please report this to the Python maintainer, along with the traceback,
150+ the Python version, and the hardware/OS platform and version."""
142151 pass
143152
144153class EOFError (StandardError ):
154+ """Read beyond end of file."""
145155 pass
146156
147157class ImportError (StandardError ):
158+ """Import can't find module, or can't find name in module."""
148159 pass
149160
150161class TypeError (StandardError ):
162+ """Inappropriate argument type."""
151163 pass
152164
153165class ValueError (StandardError ):
166+ """Inappropriate argument value (of correct type)."""
154167 pass
155168
156169class KeyboardInterrupt (StandardError ):
170+ """Program interrupted by user."""
157171 pass
158172
159173class AssertionError (StandardError ):
174+ """Assertion failed."""
160175 pass
161176
162177class ArithmeticError (StandardError ):
178+ """Base class for arithmetic errors."""
163179 pass
164180
165181class OverflowError (ArithmeticError ):
182+ """Result too large to be represented."""
166183 pass
167184
168185class FloatingPointError (ArithmeticError ):
186+ """Floating point operation failed."""
169187 pass
170188
171189class ZeroDivisionError (ArithmeticError ):
190+ """Second argument to a division or modulo operation was zero."""
172191 pass
173192
174193class LookupError (StandardError ):
194+ """Base class for lookup errors."""
175195 pass
176196
177197class IndexError (LookupError ):
198+ """Sequence index out of range."""
178199 pass
179200
180201class KeyError (LookupError ):
202+ """Mapping key not found."""
181203 pass
182204
183205class AttributeError (StandardError ):
206+ """Attribute not found."""
184207 pass
185208
186209class NameError (StandardError ):
210+ """Name not found locally or globally."""
187211 pass
188212
189213class MemoryError (StandardError ):
214+ """Out of memory."""
190215 pass
191216
192217class SystemExit (Exception ):
218+ """Request to exit from the interpreter."""
193219 def __init__ (self , * args ):
194220 self .args = args
195221 if len (args ) == 0 :
0 commit comments