Skip to content

Add documentation for annotating descriptors #9450

Open
@0xTowel

Description

@0xTowel

Documentation

Based on the discussions in #2266 and #244, it seems MyPy supports annotations for descriptors, but there doesn't seem to be anything in the documentation about this or how to properly annotate them.

Annotating these isn't obvious, and some best practice for common usages would be helpful.

For example, one common paradigm for generic data descriptors is to return self when called from a class (instance is None), and I'm struggling to find the best way to annotate that.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions