traitlets
traitlets copied to clipboard
Why prematurely clone `self.config` in `update_config()`?
In Configurable.update_config()#L214 https://github.com/ipython/traitlets/blob/4da01bfdd675783ab64a21df015e49378d91cbd2/traitlets/config/configurable.py#L206-L218
the config attribute is deep-cloned before _load_config() has the chance to validate config-values.
In case of trait-errors, this clone is wasted.
Was that on purpose?
As described in the comment you pasted, for backward-compatibility the object must not be modified at all. The modifications in _load_config are modifications.
But _load_config () does not modify the config object,
It merely passes its values into traits, no?
Note, i didn't paste any code, that's a new feature of GitHub: https://twitter.com/github/status/897879057034993665
It shouldn't matter. This assignment is purely a backward-compatibility artifact. Any code that is sensitive to where this assignment occurs should change.
I'm just asking to make sure that it is not for the cached values in loader.LazyConfigValue._value, is it?
Clarification: I only discovered this part AFTER my last comment above.