Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Data Science by (18.4k points)

I came across the function with a signature like this:

def get_quantile(numbers: List[float], q: float | int ) -> float | int | None :

What does it mean?

It's the syntax error on my python 3.8. Do I need to import something from the future to make it work?

1 Answer

0 votes
by (36.8k points)

According to PEP 604,  you need to designate the union types from Python 3.10.

So float | int will mean Union[float, int], i.e. a float or an int.

Want to be a master in Data Science? Enroll in this Data Science Courses

Browse Categories

...