4 ms·
> Casework and duck-type checks over args and *kwargs Once you start doing this in python -- beyond any low complexity usage -- you're better off capturing you
by musingsole 7y ago
> Casework and duck-type checks over args and *kwargs
Once you start doing this in python -- beyond any low complexity usage -- you're better off capturing your arguments in their own object and passing this to the function as a single argument. This object can then enforce whatever you want, and your function can now be a class method.
And then you can build a factory for this object that accepts a few args, maybe some keyword parameters. But, once that gets reasonably complex, just rinse and repeat. It's objects, methods and factories all the way down. And unlimited billable hours.