Function arguments and coupling

The more arguments a function signature has, the more likely this one is going to be tightly coupled with the caller function.

Let's say we have two functions, f1, and f2, and the latter takes five parameters. The more parameters f2 takes, the more difficult it would be for anyone trying to call that function to gather all that information and pass it along so that it can work properly.

Now, f1 seems to have all of this information because it can call it correctly. From this, we can derive two conclusions: first, f2 is probably a leaky abstraction, which means that since f1 knows everything that f2 requires, it can pretty much figure out what it is doing internally and will be able to do it by itself. So, all ...

Get Clean Code in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.