Re: [PEP 444] Future- and Generator-Based Async Idea

Alice Bevan–McGregor <alice-h+KYGxXtFYrqlBn2x/[email protected]>
Newsgroups gmane.comp.python.web
Message-ID <[email protected]>
On 2011-01-08 09:00:18 -0800, P.J. Eby said:

> (The next interesting challenge would be to integrate this withGraham's 
> proposal for adding cleanup handlers...)

class MyApplication(object):
    def __init__(self):
        pass # process startup code

    def __call__(self, environ):
        yield None # must be a generator
        pass # request code

    def __enter__(self):
        pass # request startup code

    def __exit(exc_type, exc_val, exc_tb):
        pass # request shutdown code -- regardless of exceptions

We could mandate context managers!  :D  (Which means you can still wrap 
a simple function in @contextmanager.)

	- Alice.


_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.