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

Implement json.pyi for Python's stdlib #84

Closed
brettcannon opened this issue Feb 21, 2016 · 2 comments
Closed

Implement json.pyi for Python's stdlib #84

brettcannon opened this issue Feb 21, 2016 · 2 comments

Comments

@brettcannon
Copy link
Member

See python/typing#182 for the discussion. The resulting type of things should be JSONType = t.Union[str, int, float, bool, None, t.Dict[str, t.Any], t.List[Any]] (which should end up in Python 3.6: http://bugs.python.org/issue26396).

@gvanrossum
Copy link
Member

Feel free to add this to the existing stdlib/3/json.pyi stub. Technically it should probably go in the 3.6 version -- you'd have to create a 3.6 subdir, copy json.pyi into it, and then add JSONType there. But we're not very strict about these things, and lots of other modules in stdlib/3 have features that aren't available in all versions from 3.2--3.6. At runtime people can use a trick like

if False:
    from json import JSONType

This way they can use JSONType and still run their code under 3.2--3.5. This would actually suggest that it's better not to introduce a separate 3.6 version. We should also add it to the 2.7. version.

momandine pushed a commit to momandine/typeshed that referenced this issue Jul 5, 2016
…graphs to conform to 72 characters per line.
@JelleZijlstra
Copy link
Member

The json stubs in typeshed are fine and the typing issue for adding JSONType was closed with no action, so I don't think there's anything to do here. (Feel free to reopen if you disagree.)

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

3 participants