Skip to content

Annotate alternative constructors with Self#205

Merged
kevinkjt2000 merged 1 commit intoDinnerbone:masterfrom
ItsDrike:self-type-annotation
Feb 2, 2022
Merged

Annotate alternative constructors with Self#205
kevinkjt2000 merged 1 commit intoDinnerbone:masterfrom
ItsDrike:self-type-annotation

Conversation

@ItsDrike
Copy link
Copy Markdown
Contributor

@ItsDrike ItsDrike commented Feb 2, 2022

After an approval from discord, this PR uses the recently added Self type annotation from PEP 673, scheduled to be added into python in 3.11 to annotate alternative constructors easily without having to make individual type variables for each class that needs them just to support subclassing.

Even though this type annotation isn't yet in python's standard library, the typing_extensions package does already contain it and pyright type checker does already full support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants