mirror of https://github.com/python/cpython.git
[doc] Fix error in tutorial example: type(exc) is the type rather than the instance (GH-102751)
(cherry picked from commit 8709697292
)
Co-authored-by: Jens-Hilmar Bradt <17177271+jenshb@users.noreply.github.com>
This commit is contained in:
parent
a9ece4a839
commit
f79cfb6625
|
@ -160,7 +160,7 @@ accessing ``.args``. ::
|
|||
>>> try:
|
||||
... raise Exception('spam', 'eggs')
|
||||
... except Exception as inst:
|
||||
... print(type(inst)) # the exception instance
|
||||
... print(type(inst)) # the exception type
|
||||
... print(inst.args) # arguments stored in .args
|
||||
... print(inst) # __str__ allows args to be printed directly,
|
||||
... # but may be overridden in exception subclasses
|
||||
|
|
Loading…
Reference in New Issue