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

Edit flatten #108

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Edit flatten #108

merged 2 commits into from
Dec 18, 2024

Conversation

Kodiologist
Copy link
Member

I've changed flatten a bit but left its behavior largely the same, including returning only the keys of dictionaries. Here's my thinking. The exact way that the user would like to recursively descend into various data structures probably depends on the structure. This function is supposed to be represent a naive approach that just does the simplest useful thing, leaving more specialized notions of flattening to the user. In general, it should be easier to write a new recursive function for specialized cases than to use some customizable interface that we add to flatten.

Returning a non-collection in a singleton list is more consistent behavior. The type check looks unlikely to be useful.
@Kodiologist Kodiologist merged commit ffbd27d into hylang:master Dec 18, 2024
6 checks passed
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.

Flattening list of lists of dicts leads to surprising results
1 participant