Created
June 26, 2015 18:32
-
-
Save rigid/5074630cecf3650354ec to your computer and use it in GitHub Desktop.
"super class" that iterates through multiple iterateable subclasses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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