Created
April 20, 2011 20:43
-
-
Save brettkelly/932794 to your computer and use it in GitHub Desktop.
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 ArticleFolderCollection(object): | |
"""A simple iterable collection for ArticleFolder objects""" | |
def __init__(self): | |
self.folders = [] | |
def __iter__(self): | |
for f in self.folders: | |
yield f | |
def __contains__(self, folder): | |
for f in self.folders: | |
if f.id == folder.id: | |
return True | |
return False | |
def append(self,folder): | |
self.folders.append(folder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment