Skip to content

Use object as the fallback for various Callable types #3831

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy