Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hecuba Filter creates 2 iterators, but only 1 used #246

Open
polsm91 opened this issue May 21, 2019 · 1 comment
Open

Hecuba Filter creates 2 iterators, but only 1 used #246

polsm91 opened this issue May 21, 2019 · 1 comment
Assignees
Labels

Comments

@polsm91
Copy link
Collaborator

polsm91 commented May 21, 2019

Given the following code:

filter(lambda x: x.key0 > 5, simple_dict.iteritems())

An iterator is created by the clause "simple_dict.iteritems()". Afterwards, the filter creates a second iterator with the restriction specified in the filtering clause "key0>5".

@adrianespejo
Copy link
Collaborator

In python, iteritems() and filter() create an iterator, so I think this is the way it should be. It will work using only simple_dict without iteritems(), the hecuba filter support both ways.
Anyway, how could simple_dict know that it will be the input of a filter? We could check the source code of the line, but I don't think it's necessary.

@cugni cugni closed this as completed Jan 13, 2020
@yolandab yolandab reopened this Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants