Issue 27719: Remove a doc example that is not applicable in Python 3
authorRaymond Hettinger <python@rcn.com>
Fri, 12 Aug 2016 16:43:59 +0000 (09:43 -0700)
committerRaymond Hettinger <python@rcn.com>
Fri, 12 Aug 2016 16:43:59 +0000 (09:43 -0700)
Doc/tutorial/errors.rst

index 4195c7e892f1f5f8ed6a67cbe1913134a74a93b9..ddb69cae998a860f2368ef26f240e3467f6832ae 100644 (file)
@@ -244,29 +244,7 @@ User-defined Exceptions
 
 Programs may name their own exceptions by creating a new exception class (see
 :ref:`tut-classes` for more about Python classes).  Exceptions should typically
-be derived from the :exc:`Exception` class, either directly or indirectly.  For
-example::
-
-   >>> class MyError(Exception):
-   ...     def __init__(self, value):
-   ...         self.value = value
-   ...     def __str__(self):
-   ...         return repr(self.value)
-   ...
-   >>> try:
-   ...     raise MyError(2*2)
-   ... except MyError as e:
-   ...     print('My exception occurred, value:', e.value)
-   ...
-   My exception occurred, value: 4
-   >>> raise MyError('oops!')
-   Traceback (most recent call last):
-     File "<stdin>", line 1, in ?
-   __main__.MyError: 'oops!'
-
-In this example, the default :meth:`__init__` of :class:`Exception` has been
-overridden.  The new behavior simply creates the *value* attribute.  This
-replaces the default behavior of creating the *args* attribute.
+be derived from the :exc:`Exception` class, either directly or indirectly.
 
 Exception classes can be defined which do anything any other class can do, but
 are usually kept simple, often only offering a number of attributes that allow