[Python-Dev] Flow of control - a new way - Idea

vin vin 4vinoth at gmail.com
Tue Jun 30 08:07:21 CEST 2009

HI all

I am not the too technical guy, but thinking about the new way of
controlling the flow instead of throwing an error.

as of now if we need to break a control and go back, exceptions helps,
but it is not a actual way.

it would be great if we have a control over the frames execution, I mean

A  calls B which calls C which calls D

at that point if we think to move directly to B (what error handler do
if that B has the handler defined of the error), changing the frames
instruction pointer to back to the B's position (in python code without
raising an exception) is a really useful for this web applications.

How we can achieve this? a simple way?

Actually python interpreter currently doing this.

method *A*

   method *B* <== has exception handler try: except:

      method *C*

         method *D*  <========= got exception here..

now exception handler checks that which caller methods has the exception
handler provided for this exception. in our case method B has this. so, the
instruction pointer has moved back to that method B with the exception.

We can have this same functionality* BUT WITHOUT THE USE OF EXCEPTION*.

where it can help?

so many places, & it gives the full power of execution control to the user.

A simple usage of this is :

Currently most of the WSGI frameworks breaking the flow if needed to go on
another route, it simple raising the exception, But if any of the called
modules handled those exceptions it fails the flow. and we can't guide the
extension modules to don't use full try except as it is the pythons power.

What you say?

Please excuse me if we have this control already, (can u explain?)

I hope, currently no languages gives such full control over coders.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090630/be424683/attachment.htm>

More information about the Python-Dev mailing list