I’m using Python’s configparser module and I want to wrap it in a small utility class. My goal is not to design a whole configuration system—I only want a clean way to load a .ini file and fetch values.
This works, but:
Accessing missing keys/sections raises errors.
I’m not sure if this class structure is good practice.
Should I use get() / getint() / getboolean() instead of direct indexing?
My actual question: What is the recommended way to implement the get() method so it handles missing sections/keys safely and optionally supports default values? (Example code or improvements to the snippet above would help.)