You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then I can pass around the immutable_config to any piece of code that wants it without worry, or expensive copying
This can probably be implemented by swapping MappingProxys in the guts of the config code instead of plain dicts
Describe alternatives you've considered
Not implementing this and crying?
Could maybe slap some code in __setattr__ that checks if the thing is supposed to be immutable and stops any mutations.
That sounds a little less robust than the proxies which have no __setattr__ at all.
Additional context
Add any other context about the feature request here.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently all
aconfig.Config
objects are mutable.When I have a config object that I want to distribute across an application, my choices are either:
Neither of these choices are all that great.
Describe the solution you'd like
If a config can be created with an option to be immutable, such as:
Then I can pass around the
immutable_config
to any piece of code that wants it without worry, or expensive copyingThis can probably be implemented by swapping
MappingProxy
s in the guts of the config code instead of plaindict
sDescribe alternatives you've considered
Not implementing this and crying?
Could maybe slap some code in
__setattr__
that checks if the thing is supposed to be immutable and stops any mutations.That sounds a little less robust than the proxies which have no
__setattr__
at all.Additional context
Add any other context about the feature request here.
The text was updated successfully, but these errors were encountered: