A question about the posibility of raise-yield in Python

Дамјан Георгиевски gdamjan at gmail.com
Thu Apr 15 15:34:57 CEST 2010


I'm writing this as a complete newbie (on the issue), so don't be 
surprised if it's the stupidest idea ever.

I was wondering if there was ever a discusision in the python community 
on a 'raise-yield' kind-of combined expression. I'd like to know if it 
was proposed/rejected/discussed/not-decided yet??


A 'raise-yield' expression would break the flow of a program just like 
an exception, going up the call stack until it would be handled, but 
also like yield it would be possible to continue the flow of the program 
from where it was raise-yield-ed.

This would be usefull for example in event based frameworks, they could 
just replace socket.* and similar, normally blocking, modules/functions 
with it's own 'raise-yield' enabled ones.

Then you could just take any normal imperative code that calls normal 
library networking code (say smtplib, poplib or httplib) nad run it in a 
event framework.
The normal xxxlib calls at some point would get to the now non-blocking, 
event based socket write/read, break the flow back to the event 
framework, and when it finishes the event framework would continue the 
normal flow of the program past the raise-yield.





-- 
дамјан ((( http://damjan.softver.org.mk/ )))

When you do things right, people won't be sure if you did anything at 
all.




More information about the Python-list mailing list