Skip to content

💡 Practical Experience

Virtual Environments Are Not Optional

Project A needs requests 2.28, Project B needs 2.31 — without virtual environments, they'll conflict with each other. One virtual environment per project, no exceptions. Tools like uv now make creating environments take just 1 second — there's no excuse not to use them.

Don't Hand-Write requirements.txt

Manually writing requests==2.31.0 and then discovering that its dependency urllib3 conflicts with another library you're using. Use pip freeze > requirements.txt or, even better, manage dependencies with uv / poetry — they automatically resolve version conflicts.

Don't Use print for Debugging in Production

print(f"DEBUG: {data}") left in production code is embarrassing when customers see it, and it's worse for performance than logging. Use the logging module from day one — just configure the level. logging supports file rotation, multiple modules, and remote sending; print can't do any of that.

Don't Trust Floating-Point Numbers

0.1 + 0.2 == 0.3 returns False — this is an IEEE 754 standard issue, not a Python bug. For monetary calculations, use decimal.Decimal instead of float.

List Comprehensions Aren't a Silver Bullet

A one-line list comprehension with 3 nested loops + 2 conditional checks — the code runs, but you won't understand it yourself three months later. If it needs more than one loop, use a for loop instead — readability > looking cool.