This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clarify docs for except target assignment
Type: Stage:
Components: Documentation Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fdrake Nosy List: brett.cannon, fdrake, rhettinger
Priority: normal Keywords: patch

Created on 2003-04-24 08:30 by brett.cannon, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
exc_target_docs.diff brett.cannon, 2003-04-24 08:30 2003-04-23: diff -u
Messages (4)
msg43473 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-04-24 08:30
I have always found the docs dealing with the target as found in 
'except' clauses misleading::

    try:
        raise Exception('argument 1')
    except Exception, x:
        print type(x)

This code outputs ``<type 'instance'>`` while I would have expected 
``<type 'str'>`` from the way the docs read (at least to me).  So I 
tried to clarify this in the tutorial and references (Doc/tut/tut.tex and 
Doc/ref/ref7.tex respectively).  If people think I am nuts and people 
don't get confused by the fact that having a single 
target gets the exception instance assigned to it while a tuple of 
targets gets the exception to unpack its arg values through iterating 
over them with the way the docs are now, then I guess I am nuts.  =)

Regardless of the final outcome of this patch, the result will close/
reject bug #675928 .
msg43474 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2003-04-25 17:11
Logged In: YES 
user_id=3066

There's definately a shortcoming in those docs; they really
still assume the world of string exceptions.

The patch, on the other hand, somewhat assumes a world of
class-based exceptions.  The reality is a bit more
conflated; I'll see what I can do about it, but I don't
think the patch as it stands is really right either.
msg43475 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-05-12 07:38
Logged In: YES 
user_id=357491

Fair enough.  Do you want me to keep this patch open as a reminder to you, 
Fred, or should I just go ahead and reject it?
msg43476 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-07-12 01:06
Logged In: YES 
user_id=80475

Since the tutorial now only talks about class based 
exceptions, I've applied that part of the patch after 
a rewrite.  See Doc/tut/tut.tex 1.195
History
Date User Action Args
2022-04-10 16:08:18adminsetgithub: 38358
2003-04-24 08:30:33brett.cannoncreate