cvpe/Pythonista-scripts

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]:
cvpe commented

These are just my ways of keeping you on your toes... It is fun learning all the ins and outs of Python.

cvpe commented

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”.

cvpe commented
cvpe commented

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.

cvpe commented

Building for reusablity means that:
get_synthesizer_and_voice('fr-BE') != get_synthesizer_and_voice('ja-JP')

cvpe commented
cvpe commented
cvpe commented

Return the voice, not the index of the voice.

cvpe commented

Raise an exception and return an English voice.