On 17/05/2011 18:26, Ian Kelly wrote:
You can use send the way you're wanting to. It will look something like this:
def provider():
result = None
while True:
if result is None:
if has_more_items():
next_item = get_next_item()
else:
break
elif result == 'fail':
process_fail()
next_item = None
elif result == 'succeed':
process_succeed()
next_item = None
else:
raise ValueError('unknown result %s' % result)
result = (yield next_item)
Yes, but it's this kind of birds nest I'm trying to avoid...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list