|
|
Bite-Sized Python News & Updates |
Hey Pythonista,
Happy week 23!
What are you working on this week? How are you progressing towards your goals? Share it in the community, there is a dedicated thread here.
We have a lot of exciting nuggets and updates for you this week, let's go!
- Bob & Julian
|
|
 |
|
Coding smarter not harder - 5 key ways to succeed as a developer |
On this week's Pybites Podcast episode, we discuss the 5 things you need to be doing to succeed on your dev journey. These are based on trends we're seeing while we coach, so consider this list current based on conversations we've had as recently as this month.
In short, we're talking:
Whether you've heard these or not, the conversation is worth the refresher so get on over to YouTube with the following link, or pop us into your ears using your favourite podcast app.
Enjoy the week and as always, we're here to help. Just reach out.
Julian + Bob
|
View on YouTube
|
|
|
|
How do Counter and defaultdict work? |
Ever wondered how `Counter()` 🐍 lets you do c["a"] += 1 without throwing a KeyError?
It’s thanks to the `__missing__` special method — a simple yet powerful hook that returns a default value when a key is not found. This allows you to write cleaner code without constantly checking or initializing keys.
Turns out `defaultdict()` uses the same concept, but using a `default_factory` inserting the default value on first access.
While Counter returns 0 without inserting, defaultdict actually creates the entry.
Python’s data model strikes a beautiful balance: hiding complexity while giving us powerful, elegant hooks to customize behavior.
|
Discuss on LinkedIn
|
|
|
|
Poe the Poet task runner |
I (Bob) switched from classic Makefiles to this tool, because it works really well 🚀
✅ Define tasks in pyproject.toml ✅ Run them with poe taskname ✅ Integrates well with uv
See the Python dev tooling handbook (the whole guide we can highly recommend!)
|
Python dev handbook - Poe with uv
|
|
|
|
Python is simple, not easy |
I'm considering writing a book on this.
People come to Python thinking it's the easiest language to learn, but it has the same barriers to entry as any other language. And in spite of all the complexities of tech, people always conclude that it's not having the right mindset that hinders their progress.
A good reminder: don't be put off when the going gets tough on your Python journey. The language may be simplistic, but the concepts still require the same commitment and repetition to fully grasp. Stick with it and you'll be the one on top.
If you think you'd want to give the book a once over, register your interest here.
|
Register Interest
|
|
|
|
Speeding up tail in Python |
|
As part of my new prevent-AI-from-eroding-coding-skills Bite solving routine, I solved Display the last part of a file (unix tail), and it had me reflect on doing this more effectively.
In the short LinkedIn article below I compare full-file-loading vs using a deque vs reverse reading. The latter dramatically sped up the solution when testing it against bigger data.
|
|
Read how I did it
|
|
|
Keep pushing forward on your coding journey with PyBites as your partner. We're here to help you succeed every step of the way.
|
|
 |
|
\n\n\n\n
|
|
|