Skip to the workspace
Pebellslearn by building

Python syntax & reference

Find the form you need, compare how it behaves, and open the complete explanation when you need more depth.

Python 3.10+ syntax; individual entries identify newer features. Browser exercises use the configured Python runner.

1 matching syntax entry

Hashability and dictionary keys

Learn in depth →

A hashable object has a stable hash and equality behavior suitable for dictionary/set membership.

hash(value); {(key_part_1, key_part_2): value}

Example

location = (12, 18)
print({location: "sensor"}[location])

Result

sensor

Watch for: A tuple is hashable only if all its elements are hashable. Being immutable alone does not prove an arbitrary object is hashable.

Practise this topic →
Complete explanation index (91 lessons indexed)

Mutable, Immutable & Hashable

Technical sources and review date

Original Pebells examples. Reviewed 2026-10-28.

Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.