Skip to content

Support container type annotation for classes #246

Description

@Huy-Ngo

I usually make extensive use of type annotation to take advantage of type hinting in programming tools. For example:

data: dict[int, tuple[str, int, float]] = {}
# a few data handlings later
for k, val in data.items():
    foo, bar, boo = val

k would be annotated as int, val as tuple[str, int, int], and variables foo, bar, boo here would be annotated as str, int, float respectively. However, if I use SortedDict instead of dict here, it would only annotate data as SortedDict, and the other variables here would be annotated as Any.

It would be helpful to support annotation for classes such as SortedDict and SortedSet similar to builtins like dict and set.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions