Skip to content

Instantly share code, notes, and snippets.

@chriszf
Created September 5, 2012 20:59
Show Gist options
  • Save chriszf/3644664 to your computer and use it in GitHub Desktop.
Save chriszf/3644664 to your computer and use it in GitHub Desktop.
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