Function: get_synthesizer_and_voice()
Closed this issue · 15 comments
In the braille app, would it be possible to compartmentalize a lot of objc boilerplate by creating a function of the form:
from typing import Tuple
def get_synthesizer_and_voice(language: str = 'ja-JP') -> Tuple[ObjCInstance, ObjCInstance]:
These are just my ways of keeping you on your toes... It is fun learning all the ins and outs of Python.
We are all imperfect and we all make mistakes over and over again which is why pair programming and code reviews are so powerful. Linus Torvalds most famously said “Many eyes make all bugs small”.
voice is used on line 874 and synthesizer is used on line 876 so as long as get_synthesizer_and_voice() is called before line 874 is run for the first time then we should be OK.
Building for reusablity means that:
get_synthesizer_and_voice('fr-BE') != get_synthesizer_and_voice('ja-JP')
Return the voice, not the index of the voice.
Raise an exception and return an English voice.