Martin McBride
Jul 31, 2023

--

On point 9, it is a good idea to avoid modifying the arguments passed into a function if that is practical. A good way to enforce that is to use immutable objects. If you pass in a tuple or frozen dict instead of a list or dict, for example, the called function can;t modify it.

There is a practical consideration though, if you are using very large data objects then frequent copying can hit performance very badly.

--

--

Martin McBride
Martin McBride

Responses (2)