Great.
DAY 5 is where Python stops looking like a collection of keywords and starts looking like a coherent object system.
After today, you’ll never be confused by type, object, None, or “truthy / falsy” behavior again.
🧠 DAY 5 — Built-in Data Types: The Big Picture (Python Object Model)
🔑 CORE IDEA OF DAY 5
In Python, EVERYTHING is an object — including types, functions, and classes.
There are no primitives in Python.
1️⃣ The Python Object Universe (One Diagram to Rule Them All)



At the top of Python’s universe:
object
↑
type
↑
int, str, list, dict, function, class, module, ...
Yes — type itself is an object, and type inherits from object.
2️⃣ The Holy Trinity: object, type, Instances
This triangle is interview gold.
Observe carefully:
x = 10
type(x) # int
type(int) # type
type(type) # type
issubclass(int, object) # True
Meaning:
object→ base class of everythingtype→ class that creates classes- Classes are objects too
🧠 Python is a meta-circular object system
3️⃣ What Is an Object Internally? (CPython View)
Every object has:
PyObject
├── ob_refcnt (reference count)
├── ob_type (pointer to type)
└── data (value / structure)
This is why:
- Assignment is cheap
- Passing objects is fast
- Mutation affects all references
4️⃣ Built-in Types: High-Level Taxonomy
Scalar (Immutable)
intfloatboolcomplexNoneType
Sequence
- Immutable:
str,tuple,bytes - Mutable:
list,bytearray
Set
set(mutable)frozenset(immutable)
Mapping
dict
Callable
functionmethodclass
5️⃣ Singleton Objects (VERY IMPORTANT)
Some objects exist only once in the entire runtime.
Core singletons:
NoneTrueFalseEllipsis
a = None
b = None
a is b # True
⚠️ You should always compare with is for None.
6️⃣ Truthiness Rules (Deep, Not Memorized)
Python does not have “true/false values”.
It has truthiness evaluation.
How Python decides truth:
- If object defines
__bool__()→ use it - Else if defines
__len__()→len != 0is True - Else → True by default
Falsy objects:
False
None
0, 0.0, 0j
"", [], {}, set()
Interview trap:
class A:
pass
bool(A()) # True
Why?
- No
__bool__ - No
__len__ - Default = True
7️⃣ bool Is a Subclass of int (Classic Trap)
issubclass(bool, int) # True
True + True # 2
False + True # 1
This is intentional, not a bug.
8️⃣ None Is NOT 0, False, or Empty
None == False # False
None == 0 # False
None == "" # False
But:
if None:
print("won't run")
Why?
Noneis falsy- But semantically distinct
🧠 Falsy ≠ False
9️⃣ is vs == (Now at System Level)
==→ value equality (__eq__)is→ memory identity
a = []
b = []
a == b # True
a is b # False
Never confuse:
- Logical equality
- Physical identity
10️⃣ Dynamic Typing ≠ Weak Typing
Python is:
- ✅ Dynamically typed
- ✅ Strongly typed
1 + "1" # TypeError
Type checks happen at runtime, not compile time.
11️⃣ How type() Actually Works
class A:
pass
A = type("A", (), {})
This proves:
- Classes are created by calling
type classis syntax sugar
This insight unlocks metaclasses (later days).
🔥 INTERVIEW TRAPS (DAY 5)
Q1
print(type(None))
✔ <class 'NoneType'>
Q2
print(type(object))
✔ <class 'type'>
Q3
print(type(type))
✔ <class 'type'>
Q4
print(bool([]) == False)
✔ True
But [] is False → False
🧠 DAY 5 MENTAL MODEL
Before asking “what does this do?”, ask:
- Is it an object?
- What is its type?
- Does it define special methods?
- Is identity or equality involved?
📝 DAY 5 ASSIGNMENT (MANDATORY)
1️⃣ Predict output (no running):
x = []
print(type(x) is list)
print(type(x) == list)
2️⃣ Explain clearly:
- Why Python doesn’t have primitives
- Why
boolinherits fromint
3️⃣ Whiteboard challenge:
Draw:
object
↑
type
↑
int
Explain this relationship verbally (interview-style).
🔜 DAY 6 PREVIEW
DAY 6 — Integers & Floats (CPython Internal Implementation)
You’ll learn:
- Why
10**1000works - Arbitrary precision integers
- Float precision limits
- Why
0.1 + 0.2 != 0.3
When ready, say 👉 “START DAY 6”