Skip to content

Instantly share code, notes, and snippets.

@josefdlange
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save josefdlange/bdea97655d8c56fb2d1c to your computer and use it in GitHub Desktop.

Select an option

Save josefdlange/bdea97655d8c56fb2d1c to your computer and use it in GitHub Desktop.
Class Attributes
class Pet(object):
fur_length = 10
is_alive = False
def __init__(self, name):
self.name = name
fido = Pet("Fido")
fluffy = Pet("Fluffy")
a1 = fido.is_alive
a2 = fluffy.is_alive
Pet.is_alive = True
b1 = fido.is_alive
b2 = fluffy.is_alive
fluffy.is_alive = False
c1 = fido.is_alive
c2 = fluffy.is_alive
fido.is_alive = False
d1 = fido.is_alive
d2 = fluffy.is_alive
clarence = Peth("Clarence")
e1 = clarence.is_alive
'''
What are "a1" and "a2"?
What are "b1" and "b2"?
What are "c1" and "c2"?
What are "d1" and "d2"?
What is "e1"?
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment