Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Brett Cannon
On Dec 1, 2007 11:14 PM, Chad Austin <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > On Dec 1, 2007 2:38 PM, Chad Austin <[EMAIL PROTECTED]> wrote: > >> This problem could be solved in several ways: > >> > >> 1) Make GeneratorExit derive from BaseException, just like SystemExit. > > > > We

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Antoine Pitrou
Le dimanche 02 décembre 2007 à 11:29 -0800, Chad Austin a écrit : > If socket.error, xmlrpclib.Fault, httplib.HTTPException, etc. all extended > StandardError, then we would probably be fine with that approach. But I > think > the majority of exceptions, both in the standard library and our co

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Neal Norwitz
On Dec 2, 2007 11:29 AM, Chad Austin <[EMAIL PROTECTED]> wrote: > Hi Antoine, > > Antoine Pitrou wrote: > > Hi, > > > > (I was asked to forward this from the bug tracker) > > > >> We have also run into problems where a task tries to "return" (yield > >> Return()) > >> from within a try: except Exc

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Chad Austin
Hi Antoine, Antoine Pitrou wrote: > Hi, > > (I was asked to forward this from the bug tracker) > >> We have also run into problems where a task tries to "return" (yield >> Return()) >> from within a try: except Exception: block. Since returning from a >> coroutine is >> roughly equivalent to

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Georg Brandl
Antoine Pitrou schrieb: > Hi, > > (I was asked to forward this from the bug tracker) > >> We have also run into problems where a task tries to "return" (yield >> Return()) >> from within a try: except Exception: block. Since returning from a >> coroutine is >> roughly equivalent to "raise Gene

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Nick Coghlan
Guido van Rossum wrote: > Well argued. I suggest to go for option (1) -- make GeneratorExit > inherit from BaseException. We can do this starting 2.6. Feel free to > upload a patch to bugs.python.org. It actually took me a while to figure out why this use case was convincing, when the same idea h

[Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-02 Thread Antoine Pitrou
Hi, (I was asked to forward this from the bug tracker) > We have also run into problems where a task tries to "return" (yield Return()) > from within a try: except Exception: block. Since returning from a coroutine > is > roughly equivalent to "raise GeneratorExit", the exception can be caught

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-01 Thread Chad Austin
Guido van Rossum wrote: > On Dec 1, 2007 2:38 PM, Chad Austin <[EMAIL PROTECTED]> wrote: >> This problem could be solved in several ways: >> >> 1) Make GeneratorExit derive from BaseException, just like SystemExit. > > Well argued. I suggest to go for option (1) -- make GeneratorExit > inherit fro

Re: [Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-01 Thread Guido van Rossum
On Dec 1, 2007 2:38 PM, Chad Austin <[EMAIL PROTECTED]> wrote: > Here at IMVU, we love Python 2.5's generators-as-coroutines. That feature has > let us succinctly express algorithms that intermix asynchronous network > requests > and UI operations without writing complicated state machines, and,

[Python-Dev] Problems with GeneratorExit deriving from Exception

2007-12-01 Thread Chad Austin
Hello Python-Dev, Here at IMVU, we love Python 2.5's generators-as-coroutines. That feature has let us succinctly express algorithms that intermix asynchronous network requests and UI operations without writing complicated state machines, and, perhaps most importantly, get high-quality unit tests