Skip to content

Changed tuple or list to iterable#151

Merged
kroenlein merged 3 commits intomainfrom
more-iterables
Oct 7, 2021
Merged

Changed tuple or list to iterable#151
kroenlein merged 3 commits intomainfrom
more-iterables

Conversation

@kroenlein
Copy link
Copy Markdown
Collaborator

Friction has been observed where recursive_foreach and recursive_flatmap behave badly on list-like elements such as dist_keys. This corrects those methods behavior.

@kroenlein kroenlein requested a review from bfolie October 7, 2021 02:25
Comment thread gemd/util/impl.py Outdated
elif isinstance_reversible(this):
queue.extend(reversed(this)) # Preserve order of the list/tuple
elif isinstance_iterable(this):
queue.extend(this) # Preserve order of the list/tuple
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's an example of a non-reversible iterable, and how does this preserve order?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example would be a set. The comment was accidental copy-pasta.

bfolie
bfolie previously approved these changes Oct 7, 2021
@kroenlein kroenlein merged commit c8819af into main Oct 7, 2021
@kroenlein kroenlein deleted the more-iterables branch October 7, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants