Concepts 🚀 Project 🧮 Labs
📚 Learn / Python / Variables & assignment

Variables & assignment

Names bound to objects. Python uses dynamic typing — a name can point to an int, then later to a string.

Code example

x = 42          # int
name = 'Ada'    # str
x = 'now str'   # legal — x is rebound
print(type(x))  # <class 'str'>

How it works

In Python, assignment `x = 42` does two things: (1) creates an int object `42` in memory, (2) binds the name `x` to that object. Reassigning `x = 'now str'` doesn't mutate the int — it just rebinds the name to a new str object. This is why Python is called 'dynamically typed': the type lives on the object, not on the name. The notebook's per-user namespace dict is literally a Python dict of these name→object bindings.

🔍 Where this is used in OpenBenchML Every notebook cell. The kernel state panel on /notebook shows your current name→type bindings.