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

Fix sorting of a list of dicts of meta_types #260

Merged
merged 2 commits into from Apr 2, 2018
Merged

Fix sorting of a list of dicts of meta_types #260

merged 2 commits into from Apr 2, 2018

Conversation

pbauer
Copy link
Member

@pbauer pbauer commented Mar 22, 2018

No description provided.

@@ -210,7 +210,7 @@ def __class_init__(self):
mt.append(t)
except Exception:
pass
mt.sort()
mt.sort(key=lambda k: k['name'])
self.meta_types = tuple(mt)
Copy link
Member

Choose a reason for hiding this comment

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

Small nit: I think sorted is preferable to an in-place sort, e.g.:

        self.meta_types = tuple(sorted(mt, key=lambda k: k['name']))

Also, might be cleaner to use operator.itemgetter('name')?

@pbauer pbauer changed the title WIP: fix sorting of a list of dicts of meta_types Fix sorting of a list of dicts of meta_types Mar 24, 2018
@pbauer pbauer merged commit 4b194a7 into master Apr 2, 2018
@icemac icemac deleted the py3_sorting branch April 6, 2018 06:21
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.

None yet

3 participants