special type form
- is a type to do something special within a type hint.
- is
Union, Optional, Concatenate, Literal, etc:- UnionType isn't a STF.
- basically makes
[]required whether strict mode or not in mypy. - can also be called special form as used in Python doc but I use special type form because it's more descriptive.
static type
- is an explicitly written optional type hint checked, or a type inferred by type checkers at pptime.
- can also be called pptime type but I use static type because it's completely opposite to dynamic type, which is more intuitive.
strict mode
- means to check strictly.
subtype
- is a 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,
- can also be called child type but I use subtype because it's shorter.
subtype-like type
- is a 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. - can also be called child type-like type but I use subtype-like type because it's shorter.
supertype
- is a 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,
- can also be called parent type but I use supertype because it's shorter.
supertype-like type
- is a 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. - can also be called parent type-like type but I use supertype-like type because it's shorter.
Top comments (0)