Skip to content

Instantly share code, notes, and snippets.

@chromakode
Created March 3, 2010 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chromakode/320330 to your computer and use it in GitHub Desktop.
Save chromakode/320330 to your computer and use it in GitHub Desktop.
def _iter_driver_output(self):
while self.driver_stack:
curdriver = self.driver
# Iterate over the current driver until it changes.
for output in curdriver.get_input():
yield output
# If the driver has changed, stop iterating over the old one.
if self.driver is not curdriver:
break
else:
# Driver finished.
if len(self.driver_stack) == 1:
# If it's the final one, finish iterating.
break
else:
# If it's not the final one, pop it off the stack.
self.driver_stack.pop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment