Python 1.6 The balanced language

Robin Becker robin at jessikat.fsnet.co.uk
Tue Sep 5 15:26:44 CEST 2000


In article <8p2njb01090 at news1.newsguy.com>, Alex Martelli
<aleaxit at yahoo.com> writes
....
>> I would still be interested in seeing how one goes from an enumerative
>> routine to a generator in current python. I 'claim' that this is easy
>> with 'suspend', but don't grok Structure and Interpretation of Computer
>> Programs by Abelson and Sussman too well so I find the other approaches
>> quite hard. Perhaps programming all those matrix algorithms in Fortran
>> has left me brain damaged.
>

I guess I'm not following the upcoming changes well enough. If suspend
resume semantics are available then I agree we can do generators easily
enough and presumable a lot of other things that are presently quite
hard.

>I'm not sure a generator can be made in Python by just 'wrapping' an
>"enumerative routine" -- you'd need to rework the latter to add
>explicit state/resumption, I think.  But it seems to me that Aahz
>was not talking of Python, the language, as it stands today -- he
>is, after all, taking of 'agreeing on implementation and interface'
>to have this _addition_ to the language.  E.g., a new hypothetical
>Python might have a new keyword, similar to return, that returns
>a pair -- the result being returned, and an 'internal state' needed
>for resumption at the Python instruction just after the newreturn;
>the latter could be a callable-object (to be called without args).
>
>That might let generators be implemented without, however, allowing
>the full generality of coroutines.  I dunno, I have not looked at
>the current Python sources, but I imagine this is the sort of thing
>they may be mooting...?
>
>
>Alex
>
>
>

-- 
Robin Becker



More information about the Python-list mailing list