You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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
ifFalse:
fromjsonimportJSONType
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.
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.)
Activity
gvanrossum commentedon Mar 22, 2016
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
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.
Add third-party stubs discussion outlined in python#84. Reformat para…
JelleZijlstra commentedon Apr 23, 2017
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.)
Fix tests when running pypy (python#84)