On Nov 12, 2:47 am, "John O'Hagan" <[email protected]> wrote: > I have tried using a deep update function on the original nested dictionary, > but this only works if I change the contents of a list, not if I want to, > say, change a node from a list to a dictionary or vice versa, because in that > case I'm not operating on the same object the generator is using. > > If anyone's still reading :) , how can I send new values to arbitrary sub- > generators?
I think you're focusing too heavily on generators. Just because a nifty language construct exists doesn't mean that it's the right thing to use in all situations. It sounds to me that what you really want are objects with .next() methods and externally visible state -- i.e. iterators. Or it might be that coroutines are what you're really after, although I think they would be difficult to manage in the way that you are doing. You can view the docs on the pythonic approach to coroutines at: http://docs.python.org/whatsnew/2.5.html#pep-342-new-generator-features Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
