Greg Ewing <[EMAIL PROTECTED]> wrote:
> Or maybe there should be a different mechanism altogether
> for non-local gotos. I'd like to see some kind of "longjmp"
> object that could be invoked to cause a jump back to
> a specific place. That would help alleviate the problem
> that exceptions used for control flow can get caught by
> the wrong handler. Sometimes you really want something
> that's targeted to a specific handler, not just the next
> enclosing one of some type.

I imagine you mean something like this...

    try:
        for ....:
            try:
                dosomething()
            except Exception:
                ...
    except FlowException1:
        ...

And the answer I've always heard is:

    try:
        for ....:
            try:
                dosomething()
            except FlowException1:
                raise
            except Exception:
                ...
    except FlowException1:
        ...


That really only works if you have control over the entire stack of
possible exception handlers, but it is also really the only way it
makes sense, unless I'm misunderstanding what you are asking for.  If I
am misunderstanding, please provide some sample code showing what needs
to be done now, and what you would like to be possible.

 - Josiah

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to