Issue 36023: Improve configparser.ConfigParser repr (original) (raw)
Issue36023
Created on 2019-02-18 13:13 by remi.lapeyre, last changed 2022-04-11 14:59 by admin.
Messages (3) | ||
---|---|---|
msg335831 - (view) | Author: Rémi Lapeyre (remi.lapeyre) * | Date: 2019-02-18 13:13 |
This is the current repr of the configparser.ConfigParser instances: >>> import configparser >>> config = configparser.ConfigParser() >>> config['sec'] = {} >>> config <configparser.ConfigParser object at 0x10b656ad0> I think this could be improved to read: <ConfigParser sections=('sec',)> | ||
msg335837 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2019-02-18 14:14 |
Why only sections? ConfigParser contains a lot of other information. Section names you can get by calling the sections() method. >>> config.sections() ['sec'] | ||
msg335839 - (view) | Author: Rémi Lapeyre (remi.lapeyre) * | Date: 2019-02-18 14:54 |
> Why only sections? ConfigParser contains a lot of other information. Indeed, the defaults might be useful too. Other things like options can be sessions specific and could clutter the repr if added. Would defaults() and sections() be the right behavior between too little information and too much? |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:11 | admin | set | github: 80204 |
2019-02-18 14:54:25 | remi.lapeyre | set | messages: + |
2019-02-18 14:14:25 | serhiy.storchaka | set | nosy: + serhiy.storchakamessages: + |
2019-02-18 13:47:06 | remi.lapeyre | set | title: Import configparser.ConfigParser repr -> Improve configparser.ConfigParser repr |
2019-02-18 13:42:51 | xtreak | set | nosy: + lukasz.langa |
2019-02-18 13:13:28 | remi.lapeyre | create |