Skip to content

Instantly share code, notes, and snippets.

@scizzorz
Last active August 29, 2015 13:55
Show Gist options
  • Save scizzorz/8787740 to your computer and use it in GitHub Desktop.
Save scizzorz/8787740 to your computer and use it in GitHub Desktop.
class Bunny(object):
def __init__(self, name, age):
self.name = name
self.age = age
def __str__(self):
return '%s: %s' % (self.name, str(self.age))
def __int__(self):
return self.age
def __call__(self, age):
self.age += age
def jump(self):
print('{} is jumping'.format(self.name))
@staticmethod
def new_young_bunnies(*args, **kwargs):
age = kwargs.get('age', 0)
bunnies = []
for name in args:
bunnies.append(Bunny(name, age))
return bunnies
@staticmethod
def new_young_bunnies_with_ages(*args):
bunnies = []
for name, age in args:
bunnies.append(Bunny(name, age))
return bunnies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment