A hands-on comparison with real output snippets.
If you read the previous post, you already have a general view of how Codex and Claude Code differ in approach. Now it's time to put them into a real scenario, same problem, two solutions.
We asked both models to solve a simple but layered task:
Given a JSON list of users, return only the ones with "active": true
Then generate a formatted report with name + email.
This is what happened.
## Codex Output — Fast, Direct, Minimal Structure
Codex responded quickly and generated a working implementation:
import json
def get_active_users(data):
users = json.loads(data)
active = [u for u in users if u.get("active")]
result = ""
for u in active:
result += f"{u['name']} - {u['email']}\n"
return result
# Example usage
data = '[{"name": "Ana","email": "ana@mail.com","active": true},{"name": "Luis","email":"luis@mail.com","active": false}]'
print(get_active_users(data))
✔ Works and runs immediately
✔ Minimal and efficient
— Slightly less readable as logic scales
— No extra validation or pattern enforcement
Codex is perfect if you want fast output and you’ll refine later.
Claude Code Output — Structured, Clear, Built to Scale
Claude Code approached the task differently.
Less concise, but better organized for future growth:
import json
from typing import List, Dict
def parse_users(data: str) -> List[Dict]:
"""Safely parse JSON input into Python objects."""
return json.loads(data)
def filter_active(users: List[Dict]) -> List[Dict]:
"""Return only active users."""
return [u for u in users if u.get("active") is True]
def format_report(users: List[Dict]) -> str:
"""Generate a readable name + email report."""
lines = [f"{u['name']} <{u['email']}>" for u in users]
return "\n".join(lines)
def build_user_report(data: str) -> str:
users = parse_users(data)
active = filter_active(users)
return format_report(active)
✔ Maintainable, commented, modular
✔ Easier to extend if logic grows
— Slower to write manually
— Verbose for quick prototyping
Claude thinks like someone who shares this repo with a future team.
When to Use Each One in This Task
Use Codex if you need:
- A fast function for a script or hackathon
- To test logic quickly and move on
- A starting point to optimize later
Use Claude Code when:
- You know the file will grow
- Multiple people will maintain the repo
- You plan to add validation, testing, or roles later
Same problem, different philosophies.
🎥 Quick visual version available!
Top comments (0)