[Python-ideas] Cofunctions - Back to Basics
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun Oct 21 02:18:55 CEST 2012
Christian Tismer wrote:
> Picking that up, too...
>
> On 29.10.11 09:37, Greg Ewing wrote:
>
>> If the flag were moved into the stack frame instead, it would
>> be possible to run any function in either "normal" or "coroutine"
>> mode, depending on whether it was invoked via __call__ or
>> __cocall__.
>
> What about this idea?
> I think I just wrote exactly the same thing in another thread ;-)
Yes, it's the same idea. As you can see, I did consider it at
one point, but I had second thoughts when I realised that it
wouldn't work through type slots, meaning that there would be
some areas of what appear to be pure Python code, but are not
suspendable for non-obvious reasons.
Maybe this is not a fatal problem -- we just tell people that
__xxx__ methods are not suspendable. It's something to consider.
--
Greg
More information about the Python-ideas
mailing list