Values are objects
Python variables refer to objects. They are not simple labeled boxes holding raw values.
What Python values are, how types define behavior, and why runtime concepts matter.
Why this matters
Many confusing Python behaviors become easier to understand once you stop thinking only in terms of syntax and start thinking in terms of objects, types, values, identity, and representation.
Core concepts
Python variables refer to objects. They are not simple labeled boxes holding raw values.
Truthiness, equality, representation, and operations depend on object type.
Text, bytes, and displayed output are related, but they are not the same thing.
Foundational type model
In Python, you do not declare a variable’s type ahead of time. A name can be rebound to different kinds of objects over time.
x = 42 x = "Hi"
x does not mutate the old object. It changes
which object the name refers to.
A low-level primitive value and a Python object should not be imagined as the same thing. Python values carry more structure than a raw fixed-size primitive.
In standard CPython, Python values are implemented as C-level objects with structure and metadata. That is one reason Python values behave differently from simple primitive variables in languages like C.
This is a conceptual teaching model, not a byte-for-byte memory inspector.
Type categories
These are some of the most familiar Python value types, but they are still Python objects with behavior, not raw machine primitives in the usual beginner sense.
NoneThese types are small in surface area but important for truthiness, conditional behavior, and representing the absence of a meaningful value.
These become especially important when you need to think about encoding, protocols, files, and data that is not yet decoded into text.
CPython context
These values are approximate teaching numbers for a typical 64-bit CPython mental model. They are useful for intuition, not as an exact promise for every build or version.
| Data Type | Example | Approx Size | Conceptual Comparison |
|---|---|---|---|
| int | 42 |
~28 bytes | primitive-sized value plus Python object overhead |
| float | 3.14 |
~24 bytes | numeric payload plus object structure |
| str | "A" |
~50 bytes | text object, not just a raw character |
| bool | True |
object-backed | truth value represented as a Python object |
| bytes | b"A" |
~34 bytes | binary container object |
| NoneType | None |
singleton object | special shared object representing “no value” |
Interactive labs
Explore which values Python treats as truthy or falsy.
Compare “same value” with “same object” through guided scenarios.
See how text becomes bytes and how different encodings change the binary result.
Inspect common Python values by type, category, mutability, and truthiness.
str() vs repr()Compare display-friendly output with Python’s more explicit representation of a value.
Preview which built-in types can change in place and which ones produce a new result instead.
See how different Python literals create different kinds of runtime objects.
Explore how Python numeric types interact and how result types change across expressions.
Common misconceptions
is does not mean “has the same value.”Takeaways