Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Flow of control - a new way - Idea

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


4vinoth at gmail

Jun 29, 2009, 11:07 PM

Post #1 of 4 (355 views)
Permalink
Flow of control - a new way - Idea

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.
How?

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.

--
Thanks
Vinoth


ncoghlan at gmail

Jun 30, 2009, 5:36 AM

Post #2 of 4 (321 views)
Permalink
Re: Flow of control - a new way - Idea [In reply to]

vin vin wrote:
>
> HI all
>
> I am not the too technical guy, but thinking about the new way of
> controlling the flow instead of throwing an error.

This message is too speculative/tentative for python-dev (which is about
concrete development of the next version of Python) or even python-ideas
(which is the list for speculative proposals that may possibly be
considered some day).

I suggest taking this question to the general python list
(python-list[at]python.org, also available as the newsgroup comp.lang.python).

Regards,
Nick.

--
Nick Coghlan | ncoghlan[at]gmail.com | Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


daniel at stutzbachenterprises

Jun 30, 2009, 6:44 AM

Post #3 of 4 (320 views)
Permalink
Re: Flow of control - a new way - Idea [In reply to]

On Tue, Jun 30, 2009 at 1:07 AM, vin vin<4vinoth[at]gmail.com> wrote:
> 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.

If I understand you correctly, the language feature you are looking for is
called a "continuation", which was originally developed in the LISP/Scheme
world (as "call/cc"). I'm not familiar with the details, but I believe you
can get them in Stackless Python.

Hope that helps,

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com/>


tjreedy at udel

Jun 30, 2009, 12:24 PM

Post #4 of 4 (312 views)
Permalink
Re: Flow of control - a new way - Idea [In reply to]

vin vin wrote:

Look up 'trampoline', but ask any further questions on python-list.

_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.