Skip to content

Use object as the fallback for various Callable types #3831

Closed
@JukkaL

Description

@JukkaL

If a class with __call__ can be a subtype of Callable (#3132 implements this behavior), the fallback of Callable types should probably be object. For function objects defined using def, it's perhaps still fine to use a different callback.

Additionally, callable protocol members should probably all have a object as the fallback, even those defined using def. A concrete subtype of a protocol could implement a method using an instance of a user-defined class with __call__, which could effectively have an arbitrary fallback type.

More discussion: #3132 (comment)

cc @ilevkivskyi

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions