diff --git a/speedtest-hd.py b/speedtest-hd.py index 96090fc..40dbc60 100755 --- a/speedtest-hd.py +++ b/speedtest-hd.py @@ -715,6 +715,10 @@ def main(argv: Optional[Sequence[str]] = None) -> int: confirm(cfg) + # Dictionary dispatch: map each mode name to its handler function (the values + # are the functions themselves -- no parentheses), look up the one for `mode`, + # then call it with (cfg). Equivalent to an if/elif chain over `mode`. `mode` + # is always one of these three keys by now, so the lookup can't KeyError. {"cdm": cdm_profile, "slog": slog_profile, "dd": dd_profile}[mode](cfg) return 0