On Wed, Feb 15, 2017 at 5:37 PM, Jim wrote:
> I don't recall ever seeing this before. What is this technique called?
I've heard picking which function to call sometimes called
"dispatching", and picking which function to call based on functions
held in a dictionary called "dictionary dispatch",
On 02/15/2017 04:56 PM, Alan Gauld via Tutor wrote:
On 15/02/17 22:37, Jim wrote:
self.choices = {
"1": self.show_notes,
"2": self.search_notes,
"3": self.add_note,
"4": self.modify_note,
"5": self.qui
On 15/02/17 22:37, Jim wrote:
> self.choices = {
> "1": self.show_notes,
> "2": self.search_notes,
> "3": self.add_note,
> "4": self.modify_note,
> "5": self.quit
> }
>
> The author says
import sys
from notebook import Notebook, Note
class Menu:
'''Display a menu and respond to choices when run.'''
def __init__(self):
self.notebook = Notebook()
self.choices = {
"1": self.show_notes,
"2": self.search_notes,
"3