I came across function with signature like this:
def get_quantile(numbers: List[float], q: float | int ) -> float | int | None :
What does it mean?
It's a syntax error on my python 3.8. Do I need to import something from future to make it work?
According to PEP 604, | will be used to designate union types from Python 3.10.
So float | int will mean Union[float, int], i.e. a float or an int.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With