AI engineering glossary · Python advanced
What is type hint?
Type hint (also called Type annotation): An optional annotation stating the expected type of a variable, parameter or return value. Python does not enforce it at run time, but editors and checkers use it to catch bugs and document intent.
Type hint: an example
def total(prices: list[float]) -> float: says total takes a list of floats and returns a float.
Related terms
More Python advanced terms
Where you learn it
Type hint is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.