On Thu, 15 Feb 2007 10:36:21 -0600, [EMAIL PROTECTED] 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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com