[issue34242] configparser: SectionProxy.get is silent on missing options

2018-08-08 Thread Łukasz Langa
Łukasz Langa added the comment: > I still find the remark about the parser-level `get` being maintained for > backwards compatibility strange (and it is eight years old), could this be > improved? How? Parser-level `.get()` predates mapping protocol access and has an incompatible API. Thus,

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-08-08 Thread Łukasz Langa
Łukasz Langa added the comment: > Maybe a ConfigParser object could have an option to raise errors, because > they are useful for discovering errors in config files. For this option, use mapping access instead of `.get()`: >>> cp['section']['key'] Traceback (most recent call last): ...

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-07-27 Thread Stig Johan Berggren
Stig Johan Berggren added the comment: That's fair, I didn't consider consistency with dicts' `get`. Maybe a ConfigParser object could have an option to raise errors, because they are useful for discovering errors in config files. I still find the remark about the parser-level `get` being

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-07-27 Thread INADA Naoki
Change by INADA Naoki : -- nosy: +lukasz.langa ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-07-27 Thread INADA Naoki
INADA Naoki added the comment: I don't think it's worth enough to break backward compatibility. Additionally, "section.get(key) returns None if key is not exist" is consistent with dict's behavior. On the other hand, "parser.get(section, key)" has different signature from dict's get

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-07-26 Thread Stig Johan Berggren
Change by Stig Johan Berggren : -- keywords: +patch pull_requests: +8009 stage: -> patch review ___ Python tracker ___ ___

[issue34242] configparser: SectionProxy.get is silent on missing options

2018-07-26 Thread Stig Johan Berggren
New submission from Stig Johan Berggren : `get()` on a ConfigParser object behaves differently from `get()` on a section. The former raises an exception when the key does not exist and no fallback has been explicitly set. The latter returns None, with no option to raise an error for missing