[Patches] [ python-Patches-726751 ] Clarify docs for except target assignment

SourceForge.net noreply@sourceforge.net
Fri, 25 Apr 2003 10:11:53 -0700


Patches item #726751, was opened at 2003-04-24 04:30
Message generated for change (Comment added) made by fdrake
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=726751&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Cannon (bcannon)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Clarify docs for except target assignment

Initial Comment:
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 .

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2003-04-25 13:11

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=726751&group_id=5470