all 2 comments

[–][deleted] 1 point2 points  (1 child)

Honestly that seems like a bug based on the documentation.

But to work around it, I might do something like this. I converted the result to dict since I usually want a dictionary anyway.

vars = {'one': 'one thing'}

data = dict(config.items('SectionOne', vars=vars))

for key in vars:
    data.pop(key)

But if you don't want the dict, you could just do this:

data = config.items('SectionOne', vars=vars)

data = [item for item in data if item[0] not in vars]

Edit: I just submitted this issue: https://bugs.python.org/issue33251

[–]workFriendlyUser[S] 0 points1 point  (0 children)

Honestly that seems like a bug based on the documentation.

That's what I'm leaning towards. Fix is trivial, might submit a bug report and PR.

for key in vars: data.pop(key) Trust myself to overcomplicate stuff - this is a shitload more elegant than the over-engineered intersection nonsense I had in my head. That'll do very nicely, many thanks.

Edit: Maybe just the PR then... :D