Skip to content

Advising returning X | Any in documentation #925

Closed
@Gobot1234

Description

@Gobot1234

In the typing docs https://typing.readthedocs.io/en/latest/source/stubs.html#types it states:

"Avoid union return types, since they require isinstance() checks. Use Any or X | Any if necessary."

I really don't think this is a good advise. In cases like this I'm inclined to use overloads, handle each case separately or separate functionality into separate methods/functions. I'm interested as to whether or not you think this should be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions