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

Change method names to use "dict" rather than "json"? #3

Open
pfmoore opened this issue May 27, 2022 · 2 comments
Open

Change method names to use "dict" rather than "json"? #3

pfmoore opened this issue May 27, 2022 · 2 comments
Assignees

Comments

@pfmoore
Copy link
Owner

pfmoore commented May 27, 2022

This should probably be msg_to_dict instead since the output is not actually JSON (which should be a str), but a dict decoded from JSON metadata.

Originally posted by @uranusjr in pypa/pip#11095 (comment)

I tend to refer to the type as "JSON-compatible dict", which is too long for a method name. But dict is probably better than json as an abbreviation.

@pfmoore pfmoore self-assigned this May 27, 2022
@uranusjr
Copy link

Maybe we should give this particular metadata representation a more representitive name instead? Like Structured Metadata or something (just a random idea).

@pfmoore
Copy link
Owner Author

pfmoore commented May 29, 2022

Maybe, but that's only of use here if the representative name is short enough (or can be abbreviated) to use in a function name. I don't want a name like message_headers_to_structured_metadata, and I'm not sure msg_to_struct is much better than msg_to_dict... PEP 566 called it "JSON compatible metadata", which would actually argue for the current "json" as an abbreviation.

Note that the dict form isn't standardised (it was in one of the earlier PEPs but was apparently deliberately not carried forward into packaging.python.org). IMO that was a mistake, but there you have it. If someone wanted to propose adding that representation back in, giving it a proper name at the same time, I'd be in favour, but I don't have the energy to fight for it myself.

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

No branches or pull requests

2 participants