On 22/09/2010 00:10, pyt...@bdurham.com wrote:
Is there a pythonic way to loop through a single iterator from
> multiple places in a loop?
Here's pseudo code for what I would like to do: for char in some_long_string: if char == some_char: for char in some_long_string: <--- using same iterator as above # continue to pull chars from some_long_string # until some conditions are met # repeat above pattern again several times in the loop, # with iterator access potentially nested One solution might be to convert some_long_string into a generator
> that pops of a single character at a time?
Is there a simple way wrap a string as a generator or do I need to
> create a custom function for this? it = iter(some_long_string) for char in it: if char == some_char: for char in it: # continue to pull chars from some_long_string # until some conditions are met # repeat above pattern again several times in the loop, # with iterator access potentially nested -- http://mail.python.org/mailman/listinfo/python-list