Created
September 5, 2012 20:59
-
-
Save chriszf/3644664 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 Person(object): | |
@classmethod | |
def format(cls, filename): | |
f = open(filename) | |
file_list = f.read().split() | |
f.close() | |
person_list = [] | |
for person in file_list: | |
person_list.append(cls(person)) | |
person_list.sort(key = lambda p: p.length) | |
return person_list | |
def __init__(self, name): | |
self.name = name | |
self.length = len(name) | |
class Mentor(Person): | |
pass | |
class Player(Person): | |
pass | |
mentors = Mentor.format(mentor_list) | |
players = Player.format(player_list) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment