typing.NewType
E911260
typing.NewType is a Python typing construct that allows you to create distinct, type-checked aliases of existing types without runtime overhead.
All labels observed (1)
| Label | Occurrences |
|---|---|
| typing.NewType canonical | 1 |
How this entity was disambiguated
This entity first appeared as the object of triple T11216049 — resolving that mention is where its identity was fixed. The disambiguator weighed these candidate entities and picked the highlighted one (or “None”, minting a new entity). This is how homonymy is resolved: the same surface form can point to different entities.
Target entity: typing.NewType Context triple: [PEP 484, defines, typing.NewType]
-
A.
typer
Typer is a modern, user-friendly Python library for building command-line interfaces, created by Sebastián Ramírez (tiangolo), the author of FastAPI.
-
B.
YPED
YPED is the ICAO airport code for RAAF Base Edinburgh, a major Royal Australian Air Force base located near Adelaide, South Australia.
-
C.
Typer
Typer is a modern, user-friendly Python library for building command-line interfaces, created by Sebastián Ramírez (tiangolo), that emphasizes type hints and automatic documentation.
-
D.
TYPE
TYPE is an FTP protocol command used to specify the data representation type (such as ASCII or binary) for file transfers.
-
E.
ZType
ZType is a fundamental data type abstraction used within the WikiLambda system to represent and structure functions and other typed entities in Wikimedia’s function ecosystem.
- F. None of above. chosen
- G. Unsure - the case is ambiguous/there is not enough information to decide.
Target entity: typing.NewType Target entity description: typing.NewType is a Python typing construct that allows you to create distinct, type-checked aliases of existing types without runtime overhead.
-
A.
typer
Typer is a modern, user-friendly Python library for building command-line interfaces, created by Sebastián Ramírez (tiangolo), the author of FastAPI.
-
B.
YPED
YPED is the ICAO airport code for RAAF Base Edinburgh, a major Royal Australian Air Force base located near Adelaide, South Australia.
-
C.
Typer
Typer is a modern, user-friendly Python library for building command-line interfaces, created by Sebastián Ramírez (tiangolo), that emphasizes type hints and automatic documentation.
-
D.
TYPE
TYPE is an FTP protocol command used to specify the data representation type (such as ASCII or binary) for file transfers.
-
E.
ZType
ZType is a fundamental data type abstraction used within the WikiLambda system to represent and structure functions and other typed entities in Wikimedia’s function ecosystem.
- F. None of above. chosen
Statements (47)
| Predicate | Object |
|---|---|
| instanceOf |
Python typing construct
ⓘ
function ⓘ |
| advantageOverSubclassing | no additional runtime cost ⓘ |
| alternative | subclassing built-in types for runtime distinction ⓘ |
| availableFrom | typing.NewType ⓘ |
| availableIn | Python standard library ⓘ |
| category | static typing feature ⓘ |
| commonPattern | NewType for IDs, tokens, and other opaque identifiers ⓘ |
| createdTypeAttribute | __supertype__ ⓘ |
| createdTypeInstanceOf | function that returns underlying value ⓘ |
| createdTypeIsSubclassOf | underlying type for static type checkers only ⓘ |
| createsDistinctType | true ⓘ |
| definedInModule | typing ⓘ |
| definedInPEP | PEP 484 NERFINISHED ⓘ |
| designGoal | zero-cost abstraction at runtime ⓘ |
| discouragedPattern | nesting NewType over another NewType ⓘ |
| distinguishesFrom | simple type aliases ⓘ |
| documentationLocation | Python standard library typing module docs ⓘ |
| exampleSignature | def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... ⓘ |
| exampleUse | UserId and ProductId both based on int but not interchangeable for type checkers ⓘ |
| hasNoRuntimeOverhead | true GENERATED ⓘ |
| introducedInPythonVersion | 3.5 ⓘ |
| isErasedAtRuntime | true ⓘ |
| language | Python NERFINISHED ⓘ |
| limitations | no runtime validation of values ⓘ |
| parameter |
name
ⓘ
tp ⓘ |
| purpose | create distinct type-checked aliases of existing types ⓘ |
| relatedTo |
mypy
NERFINISHED
ⓘ
typing.Annotated ⓘ typing.TypeAlias ⓘ |
| requires | from typing import NewType ⓘ |
| returns | a callable that behaves like the underlying type at runtime ⓘ |
| runtimeBehavior | returns the underlying value unchanged at runtime ⓘ |
| runtimeType | underlying type, e.g. int for NewType('UserId', int) ⓘ |
| semantics | nominal typing over an existing structural type ⓘ |
| simpleAliasComparison | type aliases are only synonyms and not distinct types for type checkers ⓘ |
| staticTypeChecking | enforced by type checkers only ⓘ |
| status | stable ⓘ |
| supportedBy |
Pyre
NERFINISHED
ⓘ
mypy ⓘ pyright ⓘ |
| supportsIntrospection | has __supertype__ attribute in created types GENERATED ⓘ |
| syntaxExample | UserId = NewType('UserId', int) ⓘ |
| useCase |
prevent mixing of semantically different but structurally identical types
ⓘ
strongly type domain-specific identifiers ⓘ |
| worksWith | functions, methods, and variables annotations ⓘ |
How these facts were elicited
The pipeline generated the facts above by prompting gpt-5.1 with this entity's name + description and the instruction below.
You are a knowledge base construction expert. Given a subject entity and a description of it, return factual statements that you know for the subject as a JSON list of dictionaries(triples), where keys must be "subject", "predicate" and "object". The number of facts may be very high, between 25 to 50 or more, for very popular subjects. For less popular subjects, the number of facts can be very low, like 5 or 10. # Requirements - If you don't know the subject at all, return an empty list. - If the subject is not a named entity, return an empty list. - Include at least one triple where predicate is "instanceOf". - Do not get too wordy. - Separate several objects into multiple triples with one object.
Subject: typing.NewType Description of subject: typing.NewType is a Python typing construct that allows you to create distinct, type-checked aliases of existing types without runtime overhead.
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.