N
Nick Mellor
Hi all,
event['Items'] is an exhausted (all used up) iterable.
Now I do the following (lines 142-4):
event.update({'Attributes': filtered_attributes})
del event['Items']
yield event
and get a KeyError on the del statement. 'Items' is a key in the event dictionary at this point.
The full file is here:
https://gist.github.com/nickmellor/5140516
I can get round it by copying all but the 'Items' member to a new dictionary, but obviously I don't want to.
Is there some deep design in Python here, that it won't delete a dict value that's an (exhausted) iterator, or have I found a bug?
Thanks for any help,
Nick
event['Items'] is an exhausted (all used up) iterable.
Now I do the following (lines 142-4):
event.update({'Attributes': filtered_attributes})
del event['Items']
yield event
and get a KeyError on the del statement. 'Items' is a key in the event dictionary at this point.
The full file is here:
https://gist.github.com/nickmellor/5140516
I can get round it by copying all but the 'Items' member to a new dictionary, but obviously I don't want to.
Is there some deep design in Python here, that it won't delete a dict value that's an (exhausted) iterator, or have I found a bug?
Thanks for any help,
Nick