diff options
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/errors.rst | 8 | ||||
-rw-r--r-- | Doc/tutorial/inputoutput.rst | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 28d6565f2a..d547ef7fcc 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -221,9 +221,11 @@ exception to occur. For example:: File "<stdin>", line 1, in ? NameError: HiThere -The sole argument to :keyword:`raise` indicates the exception to be raised. -This must be either an exception instance or an exception class (a class that -derives from :class:`Exception`). +The argument to :keyword:`raise` is an exception class or instance to be +raised. There is a deprecated alternate syntax that separates class and +constructor arguments; the above could be written as ``raise NameError, +'HiThere'``. Since it once was the only one available, the latter form is +prevalent in older code. If you need to determine whether an exception was raised but don't intend to handle it, a simpler form of the :keyword:`raise` statement allows you to diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index b1bc522b18..bfbc9a62fd 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -148,9 +148,9 @@ Positional and keyword arguments can be arbitrarily combined:: ... other='Georg') The story of Bill, Manfred, and Georg. -An optional ``':'`` and format specifier can follow the field name. This also +An optional ``':'`` and format specifier can follow the field name. This allows greater control over how the value is formatted. The following example -truncates the Pi to three places after the decimal. +truncates Pi to three places after the decimal. >>> import math >>> print 'The value of PI is approximately {0:.3f}.'.format(math.pi) @@ -204,8 +204,8 @@ operation. For example:: The value of PI is approximately 3.142. Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%`` -operator. However, because this old style of formatting will eventually removed -from the language :meth:`str.format` should generally be used. +operator. However, because this old style of formatting will eventually be +removed from the language, :meth:`str.format` should generally be used. More information can be found in the :ref:`string-formatting` section. |