Python looks simple…
but internally it’s full of surprising behavior 👇
1️⃣ Variables Are Just References 🔗
Python variables don’t store values.
They point to objects in memory.
a = [1, 2]
b = a
b.append(3)
print(a)
Output: [1, 2, 3]
👉 Both changed because they point to the SAME object.
2️⃣ Everything in Python is an Object 📦
Even integers, functions, and classes.
x = 10
print(type(x))
Output: <class 'int'>
👉 Numbers, strings, functions… all are objects.
3️⃣ Functions Are First-Class Citizens ⚡
Functions can be passed, returned, and stored.
def greet():
return "Hello"
func = greet
print(func())
Output: Hello
👉 Functions behave like normal variables.
4️⃣ Small Integers Are Cached 🧠
Python reuses small integers.
a = 256
b = 256
print(a is b)
Output: True
👉 Same object reused internally.
5️⃣ Indentation Defines Structure 📏
No curly braces needed.
if True:
print("Hello")
👉 Indentation = code structure
👉 Clean but error-prone