Hacker News new | ask | show | jobs
by mixmastamyk 2827 days ago
There are a few modules on PyPI (env, ezenv) that make the environment lookup portion more convenient/robust, by selecting a prefix for your application config. (Or write it yourself.) A prefix function that returns a mapping with the keys sliced and lowercased, works like this:

    >>> env.prefix('XDG_')
    {'config_dirs': '…', 'current_desktop': '…', 
     'session_type': 'x11', 'vtnr': '7', …}