Last active
August 29, 2015 13:55
-
-
Save scizzorz/8787740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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