dynamic type
- an implicit type always inferred by Python interpreter at runtime.
- can also be called a runtime type.
generic type
- the type besed on a generic class, function or type alias to reuse them within a type hint.
-
list,tuple,set,dict, Callable, etc. - makes
[]required in strict mode in mypy. - makes
[]optional in unstrict mode in mypy.
generics
- a feature to create the generic class, function or type alias to reuse them as a generic type within a type hint.
non-union type
- other type which isn't union type in general.
- a single type for a type hint because it's not interpreted as Union by Python interpreter at runtime:
- Python interpreter at runtime is more important program than type checkers at pre-runtime.
pre-runtime
- the time before runtime to (static) type-check, lint code, etc.
- can also be called compile time, static analysis time, etc.
runtime
- the time when Python code is running.
- can also be called execution time, running time, etc.
special typing form
- the type to do something special within a type hint.
-
Union,Optional, Concatenate, Literal, etc:-
UnionTypeisn't a special typing form.
-
- basically makes
[]required whether strict mode or not in mypy. - I use the term special typing form instead of special form which is used in Python doc because special typing form is more descriptive.
static type
- an explicitly written optional type hint checked, or a type inferred by type checkers at pre-runtime.
- can also be called a pre-runtime type.
strict mode
- checking strictly.
subtype
- the child type which has parent types as supertypes by extending them:
- Basically, a subtype is accepted by its supertypes but its supertypes aren't accepted by the subtype. For example,
boolis a subtype ofintsoboolis accepted byintbutintisn't accepted bybool.
- Basically, a subtype is accepted by its supertypes but its supertypes aren't accepted by the subtype. For example,
subtype-like type
- the type which isn't actually a subtype of other type but the type is accepted by the other type as if the type is a subtype of the other type. For example,
boolisn't actually a subtype ofcomplexandfloatbutboolis accepted by them likeboolis a subtype of them soboolis a subtype-like type ofcomplexandfloat.
supertype
- the parent type which has child types as subtypes by extended by them:
- Basically, a supertype accepts its subtypes but its subtypes don't accept the supertype. For example,
intis a supertype ofboolsointacceptsboolbutbooldoesn't acceptint.
- Basically, a supertype accepts its subtypes but its subtypes don't accept the supertype. For example,
supertype-like type
- the type which isn't actually a supertype of other type but the type accepts the other type as if the type is a supertype of the other type. For example,
complexisn't actually a supertype offloat,intandboolbutcomplexaccepts them likecomplexis a supertype of them socomplexis a supertype-like type offloat,intandbool.
typed
- having type hints.
union type
- union type as the name suggests in general.
- a set of multiple types for a type hint because it's interpreted as
Unionby Python interpreter at runtime:- Python interpreter at runtime is more important program than type checkers at pre-runtime.
unstrict mode
- not checking strictly.
untyped
- not having type hints.
Top comments (0)