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

Documentation: class -> dictionary #154

Closed
wants to merge 1 commit into from
Closed

Documentation: class -> dictionary #154

wants to merge 1 commit into from

Conversation

vidstige
Copy link

Updating documentation

As load and loads only returns an object when called with object_hook I think it makes more sense to say "dictionary" here as that is the default. See code snipped below

>>> import simplejson as json
>>> type(json.loads('{"x": 4}'))
<class 'dict'>

All-in-all this will be less confusing for newcomers, and advanced users still understands the function will return an object in case they pass object_hook.

Copy link
Member

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

The output is only a dict if the input is a JSON object. It could be any JSON value. Object is the most specific type that accurately describes the return type here. The only way to get more specific would be to say that it could be dict | list | int | float | str | bool | None or something like that.

@vidstige
Copy link
Author

I see, that makes lots of sense. The could be further clarified though.

@vidstige vidstige closed this Jan 18, 2017
@etrepum
Copy link
Member

etrepum commented Jan 18, 2017

Happy to accept PRs for clarification, as long as they're correct! :)

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

2 participants