Skip to content

JsonType could be better declared #3519

Closed
@shughes-uk

Description

@shughes-uk

Currently y'all declare JsonType:

JsonType = Union[str, int, float, bool, None, Dict[str, Any], List[Any]]

I think would be better declared as

JsonType = Union[str, int, float, bool, None, Mapping[str, "JsonType"], List["JsonType"]]

Any thoughts?

Activity

petyaslavova

petyaslavova commented on Feb 24, 2025

@petyaslavova
Collaborator

Hi @shughes-uk, thank you for your feedback! I will work on a json module related issue soon, and I will check if such a change will be appropriate for all possible cases.

self-assigned this
on Feb 24, 2025
shughes-uk

shughes-uk commented on Feb 24, 2025

@shughes-uk
Author

There's some solid discussion of it over here on the stdlib typing module python/typing#182 too if you would like some more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @shughes-uk@petyaslavova

    Issue actions

      JsonType could be better declared · Issue #3519 · redis/redis-py