Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e2d27040
Commit
e2d27040
authored
Jul 24, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6564: fix section about the two raise syntaxes.
parent
36b30b5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
Doc/tutorial/errors.rst
Doc/tutorial/errors.rst
+5
-4
No files found.
Doc/tutorial/errors.rst
View file @
e2d27040
...
@@ -221,10 +221,11 @@ exception to occur. For example::
...
@@ -221,10 +221,11 @@ exception to occur. For example::
File "<stdin>", line 1, in ?
File "<stdin>", line 1, in ?
NameError: HiThere
NameError: HiThere
The first argument to :keyword:`raise` names the exception to be raised. The
The argument to :keyword:`raise` is an exception class or instance to be
optional second argument specifies the exception's argument. Alternatively, the
raised. There is a deprecated alternate syntax that separates class and
above could be written as ``raise NameError('HiThere')``. Either form works
constructor arguments; the above could be written as ``raise NameError,
fine, but there seems to be a growing stylistic preference for the latter.
'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
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
handle it, a simpler form of the :keyword:`raise` statement allows you to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment