Skip to content

How to test type compatibility in Python 3.7? #570

Closed
@Kimi-Arthur

Description

@Kimi-Arthur

With the new fixes done in Python 3.7. We cannot test type compatibility like:

type_info = List[int]
issubclass(type_info, list)

# Or

issubclass(type_info, List)

This is expected as mentioned in PEP560. So I'm not saying I should continue to write code like that.

But since it's still useful to inspect whether type is a list or not (e.g. when you inspect the object's type hints and generate a default value for it), I wonder whether these is already a known way to test such compatibility.

Thanks!

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