Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporter default_config merging #1980

Closed
tuncbkose opened this issue Apr 21, 2023 · 0 comments · Fixed by #1981
Closed

Exporter default_config merging #1980

tuncbkose opened this issue Apr 21, 2023 · 0 comments · Fixed by #1981
Labels

Comments

@tuncbkose
Copy link
Contributor

In exporters templateexporter, html, latex, markdown,rst and asciidoc, the following is present

@property
def default_config(self):
    c = Config( some stuff here )
    c.merge(super().default_config)
    return c

where in the merging, the configuration of the exporter can be overwritten by the parent configuration. In other words, if self and super() contain different values for the same setting, the resulting config will contain the super()s setting.

I am a bit confused about why this is the case. My expectation is that the reverse should take place: a subclass should inherit its parent's configuration and modify it according to its own needs.

As a quick check, I replaced the line that is merging with

if super().default_config:
    c2 = super().default_config.copy()
    c2.merge(c)
    c = c2

and the tests are still passing (except for some skipped ones due to not installed programs).

Is there a reason why the former is preferable to the latter style of merging configs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants