Summary
Please provide frequenz.core.FloatInt, defined as the honest alias float | int.
Motivation
PEP 484 numeric tower permits an int wherever a float annotation is
expected. A value annotated only as float can therefore be an int at
runtime: isinstance(1, float) is false, case float() does not match it,
and float-only methods such as hex() are unavailable. The float | int
alias makes that runtime heterogeneity explicit to consumers and type checkers.
Current downstream home and compatibility
frequenz-client-common currently defines FloatInt as float | int. Its rationale and rejected alternatives are recorded in frequenz-client-common-python#250.
If core provides this alias, client-common would re-export the core type and
deprecate its local definition in favor of frequenz.core.FloatInt, retaining
a compatible migration path for existing consumers.
Summary
Please provide
frequenz.core.FloatInt, defined as the honest aliasfloat | int.Motivation
PEP 484 numeric tower permits an
intwherever afloatannotation isexpected. A value annotated only as
floatcan therefore be anintatruntime: isinstance(1, float) is false, case float() does not match it,
and float-only methods such as hex() are unavailable. The
float | intalias makes that runtime heterogeneity explicit to consumers and type checkers.
Current downstream home and compatibility
frequenz-client-common currently defines FloatInt as float | int. Its rationale and rejected alternatives are recorded in frequenz-client-common-python#250.
If core provides this alias, client-common would re-export the core type and
deprecate its local definition in favor of
frequenz.core.FloatInt, retaininga compatible migration path for existing consumers.