Add a comment above the Dictionary Dispatch call
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user