Skip to content

Instantly share code, notes, and snippets.

@emberian
Created July 6, 2012 00:32
Show Gist options
  • Save emberian/3057314 to your computer and use it in GitHub Desktop.
Save emberian/3057314 to your computer and use it in GitHub Desktop.
class Part(object):
inside = False
class Object(list):
def __init__(self):
self[0] = Part()
self[1] = Part()
def object_inside(o):
return all(part.inside == True for part in o)
def test_inside():
o = Object()
for part in o:
part.inside = True
assert True == object_inside(o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment