Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MusicFile(object):
- pass
- class MP3(MusicFile):
- pass
- class Midi(MusicFile):
- pass
- def file_processor(file_type):
- known_types = ['mp3': MP3, 'mid': Midi]
- if file_type in known_types: return known_types[file_type]()
- raise NotImplementedError()
Add Comment
Please, Sign In to add comment