[Python-ideas] Cofunctions - Back to Basics

Arnaud Delobelle arnodel at gmail.com
Sun Oct 30 12:35:07 CET 2011


On 28 October 2011 23:27, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Arnaud Delobelle wrote:
>
>> Hi,  I've taken the liberty to translate your examples using a small
>> utility that I wrote some time ago and modified to mimic your proposal
>> (imperfectly, of course, since this runs on unpatched python).  FWIW,
>> you can see and download the resulting files here (.html files for
>> viewing, .py files for downloading):
>>
>>    http://www.marooned.org.uk/~arno/cofunctions/
>
> Thanks for your efforts, although I'm not sure how much it
> helps to see them this way -- the whole point is to enable
> writing such code *without* going through any great
> contortions. I suppose they serve as an example of what
> you would be saved from writing.

Don't worry, it didn't take me too long.  I still think there's a
value is seeing how the same can be achieved without the machinery in
the PEP (and the yield from PEP).  In particular, it makes it possible
to discuss what limitations an approach has which the other doesn't.

E.g. one important aspect is diagnosing problems when things went
wrong (which, IIRC, was more prevalent in the initial discussion of
this proposal on this list).  This is mentioned in the "Motivation and
Rationale" section, but there is no reason a priori why the same
safeguards couldn't be put in place without the PEP.

-- 
Arnaud



More information about the Python-ideas mailing list