On Thu, 15 Feb 2007 10:36:21 -0600, dustin at v.igoro.us wrote: > [snip] > >def fetchSequence(...): > fetcher = Fetcher() > yield fetcher.fetchHomepage() > firstData = yield fetcher.fetchPage('http://...') > if someCondition(firstData): > while True: > secondData = yield fetcher.fetchPage('http://...') > # ... > if someOtherCondition(secondData): break > else: > # ... Ahem: from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks from twisted.web.client importt getPage @inlineCallbacks def fetchSequence(...): homepage = yield getPage(homepage) firstData = yield getPage(anotherPage) if someCondition(firstData): while: secondData = yield getPage(wherever) if someOtherCondition(secondData): break else: ... So as I pointed out in another message in this thread, for several years it has been possible to do this with Twisted. Since Python 2.5, you can do it exactly as I have written above, which looks exactly the same as your example code. Is the only problem here that this style of development hasn't had been made visible enough? Jean-Paul
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