Skip to content

official api method to check if a Type is parametrized or not #423

Description

@smarie

Hello there,

I am relying on PEP484 in a declarative parser/converter registry project, where the user can e.g. say "please parse a Dict[str, Tuple[pd.Dataframe, pd.Series]] from this directory".
In several places in the code I end up having to check if a given Type is parametrized or not, and find its 'base' non-parametrized type.

At present there is an unofficial way to do that : check if the cls.__origin__ field exist and is not None. Maybe this should be worth putting in the official API with a couple methods such as is_parametrized, and get_base_type. What do you think ?

Thanks for this great tool

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