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.

Level: beginnerTopic: Python advanced

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.