re: A short example of how types can make your life easier VIEW POST


All items of enums are objects:

ab = Audiobook('mp3')
eb = Ebook('mobi')
pb = Paperback('A5')
hb = Hardback()        # select 1 of 4, eg. Paperback
order =  # inject book format for save

You may create another formats in future, without change enum.

code of conduct - report abuse