[Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

Richard Damon Richard at Damon-Family.org
Mon Jan 7 23:15:34 EST 2019

On 1/7/19 3:38 PM, Barry wrote:
>> On 7 Jan 2019, at 03:06, Richard Damon <Richard at damon-family.org> wrote:
>> For something like reading options from a config file, I would use a
>> call that specifies the key and a value to use if the key isn't present,
>> and inside that function I might use a try to handle any exception
>> caused when processing the key, and it could return the default.
> Most config file APIs I have used have has_section and has_key type functions that remove the need to catch exceptions.
> What config file API are you using htat is missing this?
> Barry
I was talking about if I was to roll my own, I would start by calling a
function I was writing with the key / default value, and it might have a
try block so any error that threw an exception would cause it to fall
back to the default value.

The OP is obviously obviously thinking of something a bit off standard,
or he would just be using a standard config reader, and not need this.
Maybe the issue is parsing the data from the config line into some
internal format, and wanting to catch bad values, like a line that said
"nfiles = 42balloons" that throws when it is expecting just a number.

Richard Damon

More information about the Python-ideas mailing list