At first: This is only a question about the "cleanest" way to code.
I've written a Python script/programm with several classes and functions, to store some spanish vocabulary. At the end all comes together in the interface function, which passes on some user input. Roughly like this:
if __name__ == "__main__":
while True:
answ = raw_input("Please select an option below:\n"
"(1) New Vocab\n"
"(2) Testing Vocabs\n"
"(3) Search vocab (Edit|Delet)\n"
"(4) List all vocabs\n"
"(5) Show Boxes\n")
#...blabla
os.system("clear")
if INPUT(answ,"1"):
IF_new_vocab(book)
book.save_dic()
elif INPUT(answ,"2"):
IF_voc_query(book)
book.save_dic()
elif INPUT(answ,"3"):
book.search_vocab()
book.save_dic()
elif INPUT(answ,"4"):
print book.show_cache() #A
elif INPUT(answ,"5"):
book.update_boxes()
book.show_boxes() #B
#...blabla
Now my QUESTION is: Should I return a string and use print as late as possible, which would be the "interface" in this case. (e.g. option A)? Or should the output, which is in most cases a string, be printed by the method/function itself (e.g. option B)?
I know it doesn't affect the overall output at all. But I was always wondering if there is a convention or reason to prefer one option.