Functions that are not part of the public API which have default values for arguments, but which are never used without specifying values for those arguments, can be simplified by removing the default values.
i'm working in a large, public python codebase. I have a general feeling that this codebase has massive overuse of argument defaults in methods and I would love to lint for this. This happens in a couple of different ways-
a non-public function has many arguments with default values, however it is never called without fully-specifying the default values anywhere
functions that repeatedly delegate to lower-level functions, but repeat the default arguments redundantly at every level in the hierarchy
it's the second case here that causes the biggest headaches in this particular codebase. The function signatures are very noisy. Also (in my case) the default value is almost always None, and it takes some serious archaeology to try and figure out what it means to leave out any particular arg (None is often semantically different to not None).
Explanation
Functions that are not part of the public API which have default values for arguments, but which are never used without specifying values for those arguments, can be simplified by removing the default values.
i'm working in a large, public python codebase. I have a general feeling that this codebase has massive overuse of argument defaults in methods and I would love to lint for this. This happens in a couple of different ways-
it's the second case here that causes the biggest headaches in this particular codebase. The function signatures are very noisy. Also (in my case) the default value is almost always
None
, and it takes some serious archaeology to try and figure out what it means to leave out any particular arg (None
is often semantically different tonot None
).Example
Bad
Good