This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Tsvika Shapira
Recipients Tsvika Shapira
Date 2019-04-14.09:32:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1555234323.36.0.791779964301.issue36627@roundup.psfhosted.org>
In-reply-to
Content
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']]"
History
Date User Action Args
2019-04-14 09:32:03Tsvika Shapirasetrecipients: + Tsvika Shapira
2019-04-14 09:32:03Tsvika Shapirasetmessageid: <1555234323.36.0.791779964301.issue36627@roundup.psfhosted.org>
2019-04-14 09:32:03Tsvika Shapiralinkissue36627 messages
2019-04-14 09:32:03Tsvika Shapiracreate