AI engineering glossary · Python core

What is keyword?

Keyword: A word reserved by Python with a fixed meaning in the syntax, such as if, for, while, def, return, import, True and None. Keywords cannot be used as identifiers. The keyword module lists them all.

Level: beginnerTopic: Python core

Keyword: an example

Writing for = 3 is a SyntaxError because for is a keyword. import keyword; keyword.kwlist prints the reserved words.

Related terms

More Python core terms

Where you learn it

Keyword 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.