send() to a generator in a "for" loop with continue(val)??

Aahz aahz at pythoncraft.com
Sun Apr 19 09:07:15 EDT 2009


In article <gsetb1$jop$03$1 at news.t-online.com>,
Peter Otten  <__peter__ at web.de> wrote:
>Aahz wrote:
>> In article
>> <07ad771b-a6d1-4f08-b16c-07caf74623c3 at e18g2000yqo.googlegroups.com>,
>> Michele Simionato  <michele.simionato at gmail.com> wrote:
>>>On Apr 18, 3:03=A0pm, a... at pythoncraft.com (Aahz) wrote:
>>>> In article <gsc7e1$rj6$0... at news.t-online.com>,
>>>> Peter Otten =A0<__pete... at web.de> wrote:
>>>>>
>>>>>If it were up to me I'd rip out send() immediatly. At first I thought I
>>>>>would see a compelling use case and be enlightened, but it never
>>>>>happened.
>>>>
>>>> Too late -- it's likely to get an upgrade for 3.1 and 2.7.
>
>Could you give some details or a link?

http://mail.python.org/pipermail/python-ideas/2009-April/004189.html

(You'll need to backtrack considerably to see the full discussion.)

>Are you currently using coroutines in Python? If so, what kind of practical
>problems do they simplify for you?

I'm not; I avoid coroutines like the plague.  ;-)  I much prefer nice,
simple threading...

>What I've seen so far is that the once beautifully simple generator
>mechanism has become very complex with the recent additions for ressource
>management and coroutines.
>
>The send()/yield-expression duo on the other hand is limping along, and
>someone like Michele who is definitely in the "intended audience" for the
>more arcane features of Python says that you can do it with a library.
>If that is possible shouldn't it have been the first step to put such a
>library into the stdlib and see how it fares?

You have a point; I wasn't paying much attention when send() was first
added, so I can't argue for it.  I'm just referring you to material I
happen to have handy that discusses use for it.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list