Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(27884)

Side by Side Diff: Doc/library/exceptions.rst

Issue 11682: PEP 380 reference implementation for 3.3
Patch Set: Created 8 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Doc/reference/expressions.rst » ('j') | Doc/reference/expressions.rst » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. _bltin-exceptions: 1 .. _bltin-exceptions:
2 2
3 Built-in Exceptions 3 Built-in Exceptions
4 =================== 4 ===================
5 5
6 .. index:: 6 .. index::
7 statement: try 7 statement: try
8 statement: except 8 statement: except
9 9
10 In Python, all exceptions must be instances of a class that derives from 10 In Python, all exceptions must be instances of a class that derives from
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 Raised when an error is detected that doesn't fall in any of the other 256 Raised when an error is detected that doesn't fall in any of the other
257 categories. The associated value is a string indicating what precisely went 257 categories. The associated value is a string indicating what precisely went
258 wrong. (This exception is mostly a relic from a previous version of the 258 wrong. (This exception is mostly a relic from a previous version of the
259 interpreter; it is not used very much any more.) 259 interpreter; it is not used very much any more.)
260 260
261 261
262 .. exception:: StopIteration 262 .. exception:: StopIteration
263 263
264 Raised by built-in function :func:`next` and an :term:`iterator`\'s 264 Raised by built-in function :func:`next` and an :term:`iterator`\'s
265 :meth:`__next__` method to signal that there are no further values. 265 :obj:`~iterator.__next__` method to signal that there are no
266 further items in the sequence.
eric.araujo 2011/09/21 16:25:47 Please use “elements”; the doc is very careful to
266 267
268 The exception object has a single attribute :attr:`value`, which is
269 given as an argument when constructing the exception, and defaults
270 to :const:`None`. When a generator function returns, a
eric.araujo 2011/09/21 16:25:47 Should be ``None``.
271 :exc:`StopIteration` is raised, and the value returned by the
272 function is used as the :attr:`value` parameter to the constructor
273 of the exception.
267 274
268 .. exception:: SyntaxError 275 .. exception:: SyntaxError
269 276
270 Raised when the parser encounters a syntax error. This may occur in an 277 Raised when the parser encounters a syntax error. This may occur in an
271 :keyword:`import` statement, in a call to the built-in functions :func:`exec` 278 :keyword:`import` statement, in a call to the built-in functions :func:`exec`
272 or :func:`eval`, or when reading the initial script or standard input 279 or :func:`eval`, or when reading the initial script or standard input
273 (also interactively). 280 (also interactively).
274 281
275 Instances of this class have attributes :attr:`filename`, :attr:`lineno`, 282 Instances of this class have attributes :attr:`filename`, :attr:`lineno`,
276 :attr:`offset` and :attr:`text` for easier access to the details. :func:`str ` 283 :attr:`offset` and :attr:`text` for easier access to the details. :func:`str `
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 .. versionadded:: 3.2 462 .. versionadded:: 3.2
456 463
457 464
458 465
459 Exception hierarchy 466 Exception hierarchy
460 ------------------- 467 -------------------
461 468
462 The class hierarchy for built-in exceptions is: 469 The class hierarchy for built-in exceptions is:
463 470
464 .. literalinclude:: ../../Lib/test/exception_hierarchy.txt 471 .. literalinclude:: ../../Lib/test/exception_hierarchy.txt
OLDNEW
« no previous file with comments | « no previous file | Doc/reference/expressions.rst » ('j') | Doc/reference/expressions.rst » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+