Message340200
the following code:
```
lists_to_filter = [
['a', 'exclude'],
['b']
]
# notice that when 'exclude' is the last element, the code returns the expected result
for exclude_label in ['exclude', 'something']:
lists_to_filter = (labels_list for labels_list in lists_to_filter if exclude_label not in labels_list)
# notice that changing the line above to the commented line below (i.e. expanding the generator to a list) will make the code output the expected result,
# i.e. the issue is only when using filter on another filter, and not on a list
# lists_to_filter = [labels_list for labels_list in lists_to_filter if exclude_label not in labels_list]
lists_to_filter = list(lists_to_filter)
print(lists_to_filter)
```
as far as i understand, the code above should output "[['b']]"
instead it outputs "[['a', 'exclude'], ['b']]" |
|
Date |
User |
Action |
Args |
2019-04-14 09:32:03 | Tsvika Shapira | set | recipients:
+ Tsvika Shapira |
2019-04-14 09:32:03 | Tsvika Shapira | set | messageid: <1555234323.36.0.791779964301.issue36627@roundup.psfhosted.org> |
2019-04-14 09:32:03 | Tsvika Shapira | link | issue36627 messages |
2019-04-14 09:32:03 | Tsvika Shapira | create | |
|