Inheriting keyword arguments using super(), but they are not listed untill specified in creating instance
This has nothing to do with super
or inheritance. It's just parameters taking on their default values when no arguments are passed. Here's a simple example:
def foo(x=5): print('foo: x =', x)def bar(*args, **kwargs): print('bar:', args, kwargs) foo(**kwargs)bar()bar(x=2)
Output:
bar: () {}foo: x = 5bar: () {'x': 2}foo: x = 2
args
and kwargs
are the values that are passed to bar
, and in the end the same values are passed to foo
. If nothing gets passed to bar
, then nothing is passed to foo
, and the default values are used.
super().__init__(*args, **kw)
is equivalent to MainApp.__init__(*args, **kw)
. The default values aren't being 'inherited', they're just being used as normal.