At 08:43 PM 3/26/2009 +1200, Greg Ewing wrote: >Trying to think of a better usage example that >combines send() with returning values, I've realized >that part of the problem is that I don't actually >know of any realistic uses for send() in the first >place. > >Can anyone point me to any? Maybe it will help >to inspire a better example. Er, well, I don't know what anybody *else* wanted them for, but I wanted them to implement improved trampoline functions, vs. earlier Python versions. ;-) The trampoline example I gave uses send() in order to pass the return values from one generator back into another. Of course, the task object also has a send(), so if you do find another use case for send() in a co-operative context, it should be equally doable with the trampoline.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4