Optimizing the Number of Arguments in Functions
Learn about optimizing the number of arguments in Python functions.
We'll cover the following
Having functions or methods that take too many arguments is a sign of bad design (a code smell). Let’s explore ways of dealing with this issue.
The first alternative is a more general principle of software design—reification (creating a new object for all of those arguments that we are passing, which is probably the abstraction we are missing). Compacting multiple arguments into a new object is not a solution specific to Python, but rather something that we can apply in any programming language.
Get hands-on with 1400+ tech skills courses.