Skip to content

Instantly share code, notes, and snippets.

@xarg
Created November 23, 2011 14:34
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 xarg/1388813 to your computer and use it in GitHub Desktop.
Save xarg/1388813 to your computer and use it in GitHub Desktop.
Apples and Oranges
class Apple:
worm = "~~~"
class Orange:
def slices(self):
return [1, 2, 3]
def get_slices(basket):
"""For each item in the basket get it's slices"""
slices = []
for item in basket:
slices.append(item.slices())
return slices
if __name__ == '__main__':
basket = []
basket.append(Orange())
basket.append(Apple())
print get_slices(basket)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment