beetbox / confuse

painless YAML config files for Python
https://pypi.org/project/confuse/
MIT License
412 stars 51 forks source link

immutability #8

Open thejohnfreeman opened 9 years ago

thejohnfreeman commented 9 years ago

Configurations should be immutable. Compositions should preserve immutability and return new configurations. Yea or nay? I don't regard this as an important feature since most of the time clients don't need to keep around multiple configurations, but it might come in handy down the line and generally doesn't cost that much. Additionally, it is possible to provide both mutating and non-mutating versions of compositions, so one option is to have both.

sampsyo commented 9 years ago

That's a good question. In my experience, mutating configurations—for the purposes of lazy loading, overlaying with command-line flags, etc.—is the source of many frustrating bugs, so it would be great to at least explore what an immutable API would look like.