Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Consider showing type information in PEP 484 format #346

@jakebailey

Description

@jakebailey

An example of the current behavior:

image

When we show list[int, int], what we mean is that it's a list with two items, both of type int. However, if I go write a function which would accept this variable, I would actually write:

from typing import List

def print_odd_even(l: List[List[int]]):
    for l2 in l:
        for x in l2:
        print(x, "is even" if x % 2 == 0 else "is odd")

These two syntaxes are nearly identical, and I think that even though the current behavior is more "exact", the conflict between the official type hint syntax may cause confusion as we improve our support for typing/generics.

I think it's worth figuring out if we should stop including the extra info we have in its current form, and maybe try to figure out some better way to show the info that doesn't conflict with the standard way of writing types in PEP 484.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions