minus-squarechemacortes@programming.devtoPython@programming.dev•Typed Python: Choose Sequence over ListlinkfedilinkEnglisharrow-up3·1 year agoSequence now lives at collections.abc. BTW, float is not a supertype of int (issubclass(int, float) == False). Normaly, It is acceptable to use int instead of float, but speaking of variance, it is more precise to use numbers.Real: issubclass(Integral, Real) == True issubclass(int, Real) == True issubclass(float, Real) == True issubclass(complex, Real) == False linkfedilink
Sequence
now lives atcollections.abc
. BTW,float
is not a supertype ofint
(issubclass(int, float) == False
). Normaly, It is acceptable to useint
instead offloat
, but speaking of variance, it is more precise to usenumbers.Real
:issubclass(Integral, Real) == True issubclass(int, Real) == True issubclass(float, Real) == True issubclass(complex, Real) == False