jfj wrote:
IMHO, a more clean operation of raise would be either:
  1) raise w/o args allowed *only* inside an except clause to
     re-raise the exception being handled by the clause.

Wait! second that. We would like to

###############
def bar():
     raise

def b5():
    try:
        raise A
    except:
        bar ()
#################

So, restricting raise into except clauses only, is not good.
Change the proposal to:
>   1) raise w/o args re-raises the exception being handled
>      or UnhandledException.

here is another confusing case:

###################
import sys

class A:
 pass

class B:
 pass

def foo ():
    try:
        raise B
    except:
        pass
    raise


def b1(): try: raise A except: foo()

try:
    b1 ()
except:
    print sys.exc_info()[0]
##################

This reports that __main__.B is raised but wouldn't it be better
to raise an 'A' since this is the currently handled exception?

jf

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to