Skip to content

handling indexerror for ConfigParser.get #4971

@wyli

Description

@wyli

I noticed that if we had a dictionary:

config = {
    'key1':
        [{'key2_1': 1}, {'key2_2': 2}]
}

config.get('key1#2') will throw an error instead of returning a None because it only catches KeyError. I would like to suggest including IndexError so that we can have a unified interface. Thanks

Originally posted by @mingxin-zheng in #4765 (comment)

the current implementation can only handle keyerror

except KeyError:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions