Skip to content

AnyPath is not a subclass of AnyPath #246

@chbehrens

Description

@chbehrens

It would be helpful if issubclass(AnyPath, AnyPath) returns True as usually expected if a class is checked against itself. Do you see any possibility to modify it in such a way or is there a good reason why this shouldn't be the case? Unfortunately, I'm not familiar enough with ABCs to directly suggest a solution.

I came across a use case where I want to make sure, that the type of a field is a subclass of a list of classes. Originally, I used pathlib.Path there and checked against (str, numbers.Number, Path) but as cloud paths should become an option, I'd like to replace pathlib.Path with cloudlib.AnyPath.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions