-
Couldn't load subscription status.
- Fork 275
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
From python/typeshed#14558: Some classes (like re.Pattern) are not instantiable at runtime:
>>> import re
>>> re.Pattern()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot create 're.Pattern' instancesCurrently, there is no working way to mark classes as such. Ideas to mark classes:
- Annotate the return type of
__new__asNoReturn/Never. - Set
__new__toNone(similar to how__hash__works). - A new decorator.
dchevell and brianschubert
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations