Skip to content

Instantly share code, notes, and snippets.

@rigid
Created June 26, 2015 18:32
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 rigid/5074630cecf3650354ec to your computer and use it in GitHub Desktop.
Save rigid/5074630cecf3650354ec to your computer and use it in GitHub Desktop.
"super class" that iterates through multiple iterateable subclasses
class A(object):
def __iter__(self):
# inits something
return self
def next(self):
return something
class B(object):
def __iter__(self):
# init something
return self
def next(self):
return something
class Super(object):
def __iter__(self):
classlist = [ A(), B() ]
return self
def next(self):
# should return every object from A() and after that, every object from B()
return ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment