AI engineering glossary · Python core

What is hashable?

Hashable: Describes an object with a hash value that never changes during its lifetime and that can be compared for equality. Only hashable objects can be dictionary keys or set members. Immutable built-ins are hashable; lists, dicts and sets are not.

Level: advancedTopic: Python core

Hashable: an example

hash('abc') works and {(1, 2): 'ok'} is valid, but {[1, 2]: 'x'} raises TypeError: unhashable type: 'list'.

Related terms

More Python core terms

Where you learn it

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