How can you tell if a Python datetime is a weekend (i.e., Saturday or Sunday)? Invoke weekday(). It returns an int; Mon is 0, Sat is 5 and Sun is 6. So:
Consider this Python: Surprised? That’s because “is” is the wrong comparison: • == asks: are these the same value?• is asks: are these the same object? You almost never care about question #2. And so, should rarely use “is”.
Want to make Python numbers more readable? Use _ between digits (not at the start or end):
Can you believe that 2025 is almost over? It was full of big events for me, and yet it also whizzed past at breakneck speed. And so, before we start 2026, I want to share a whole bunch of updates on what I’ve done over the last 12 months — and where I plan to…
30 years! It’s hard to believe, but it was in December 1995 (i.e., 30 years ago) that I went freelance, giving up a stable corporate paycheck. And somehow, I’ve managed to make it work: During that time, I’ve gotten married, bought a house, raised three children, gone on numerous vacations, and generally enjoyed a good…
You’ve probably heard about uv: But using uv isn’t just about learning a few commands. It’s about changing how you think about packaging, and what commands you run on a regular basis. That’s why I’ve created a free uv crash course. Every day, for 12 days, you’ll get insights into how to (and how not…
I’ve been teaching Python and Pandas for decades — in companies, at conferences, and on YouTube — and I keep hearing the same frustrations everywhere I go: That’s why I’ve spent the last few months completely rebuilding LernerPython.com. It’s a complete, structured learning experience, not just a set of courses. Instead of leaving you on…
Bottom line: If you’re typing uv pip install, you’re treating uv as a faster pip and missing the point. uv is built around projects: run uv init myproj to create a pyproject.toml, uv add to record dependencies, and uv run to execute your code. Do that, and you can ignore pip, venv, and pyenv entirely.…