I remember reading the updates when f strings were added and getting genuinely excited. Complicated string formatting is so much more readable now.
Your example of Counter from collections is also perfect. That first time I found out about it was fantastic and depressing. I couldn't imagine how much time I'd wasted writing loops to do the same task.
Generally, Python has one thing to remember: if you're doing it regularly in code, others probably do as well, so there's probably a library for it. If you're lucky, it might have been written in C and be more efficient than anything you can write in Python.
Great article.
I remember reading the updates when f strings were added and getting genuinely excited. Complicated string formatting is so much more readable now.
Your example of Counter from collections is also perfect. That first time I found out about it was fantastic and depressing. I couldn't imagine how much time I'd wasted writing loops to do the same task.
Generally, Python has one thing to remember: if you're doing it regularly in code, others probably do as well, so there's probably a library for it. If you're lucky, it might have been written in C and be more efficient than anything you can write in Python.
Thank you and by the way, this is really a good thing to remember.