Open shuttle1987 opened 4 years ago
For educational reasons I think it's worth noting that function calls in Python are slow and the keyword arguments is not something that is particularly slower than positional arguments. As a result the extra readability and reduced possibilities for bugs/defects that this allows doesn't come at the expense of much of a tradeoff in other areas.
Take for example this line:
https://github.com/JamesDevJim/game-zulu/blob/4b46243499803992d0ef07bb856fb49bb8f72240/whiskey.py#L56
This can be rewritten to use keyword arguments as follows:
This was you don't have to be thinking about what order these arguments are in. Seeing as these arguments are distinct and re-ordering them arbitrarily makes no sense it's best to not use semantics that depend on the positions of the arguments.
If you wan to force the calling sites to use keyword arguments only you can change:
https://github.com/JamesDevJim/game-zulu/blob/2689e3baa95e1bcc8c3f203fe3f701a94191ed72/test_light_strip.py#L27
To this:
The
*
as the first argument has special meaning here and effectively disables the use of positional (non-named) arguments