Skip to content

Instantly share code, notes, and snippets.

@brettkelly
Created April 20, 2011 20:43
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 brettkelly/932794 to your computer and use it in GitHub Desktop.
Save brettkelly/932794 to your computer and use it in GitHub Desktop.
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