I was looking at the Django source code today and I noticed this:
class DjangoTestSuiteRunner(object):
def __init__(self, verbosity=1, interactive=True, failfast=True, **kwargs):
self.verbosity = verbosity
self.interactive = interactive
self.failfast = failfast
Why would they accept kwargs in the constructor but then not do anything with them?
This pattern can make backwards/forwards compatibility easier. If the newer/older version of the code has more/less parameters then you won't break everything.
Also, when you are inheriting this class (for example with mixins) it can be convenient to just accept everything.
Imho it's not a pretty pattern to use, but it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With