[Python-ideas] Possible PEP 380 tweak

Ron Adam rrr at ronadam.com
Tue Oct 26 08:57:32 CEST 2010

On 10/25/2010 08:34 PM, Guido van Rossum wrote:
> On Mon, Oct 25, 2010 at 6:01 PM, Ron Adam<rrr at ronadam.com>  wrote:
>> On 10/25/2010 03:21 PM, Guido van Rossum wrote:
>>> On Mon, Oct 25, 2010 at 12:53 PM, Ron Adam<rrr at ronadam.com>    wrote:
>>>> This is how my mind wants to write this.
>>>> @consumer
>>>> def reduce_collector(func):
>>>>     try:
>>>>         value = yield            # No value to yield here.
>>>>         while True:
>>>>             value = func((yield), value)        # or here.
>>>>     except YieldError:

> Well maybe I was misunderstanding your proposed YieldError. You didn't
> really explain it -- you just used it and assumed everybody understood
> what you meant.

Sorry about that, it is too easy to think something is clear on these 
boards when in fact it's isn't as clear as we (I in this case) think it is.

hmmm ... I feel a bit embarrassed because I wasn't really meaning to try to 
convince you to do this.  It's just what first came to mind when I asked 
myself, "if there was an easier way to write it, how would I do it?".  As 
you pointed out, it isn't that much different from the c.close() example 
Jacob gave.

To me, that is a nice indication that you (and Jacob and Greg) are on the 
right track.

I think YieldError is an interesting concept, but it requires too many 
changes to make it work.

( I just wish I could be of more help here.  :-/ )


More information about the Python-ideas mailing list