ARTICLE AD BOX
Asked 5 years, 6 months ago
Viewed 11k times
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?
12.3k5 gold badges23 silver badges61 bronze badges
1
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.
Sign up to request clarification or add additional context in comments.
It means or. So q: float | int means that q may either be a float or an int.
2 Comments
Explore related questions
See similar questions with these tags.

