Kids on Python is a kids oriented introduction to programming workshop I prepared after having that thought in my mind for quite some time. In early 2019, a close friend came to me looking for ways of initiating one of his kids to computer programming. After countless discussions, thinking things through down to the most tiny details, figuring out which skills we might be taking for granted and either avoiding their need or including them in the journey, at some point, I finally sat down and wrote the thing: this is what came out of it.
After having introduced Python to so many developers of varying skill levels and experience, I felt a growing need for this: a single printed sheet with a quick-reference to the language. I’m now sharing my first take on it, along with some context, thoughts, and possible challenges ahead.
Moving on with our journey, in this article we’ll look into possible letter counting API improvements. To recap, we started exploring the general “counting things” problem in the first article in the series, focused on building a letter histogram from a given text, as a motive to introduce several techniques and useful Standard Library tools. We iterated a few times until we obtained a short, simple and fast letter counting function. In the second article, with the purpose of generalizing our letter counting function, we delved into unicode land, learning about the unicodedata Standard Library module, and highlighting a few of many language specific nuances we wanted our code to handle. With that knowledge we created several utility functions that, while powerful, are not necessarily easy to use. What can we do? Let’s see…
In the first installment of this journey we created progressively simple versions of a letter histogram creation function, as a motivation to introduce useful built-in and Standard Library Tools, while sharing general ideas about code simplification. The resulting code was short and fast, meeting all initial requirements. But it should be better. In this article I’ll explore further refinements to our solution, raising the bar on the requirements: this will steer us into the exploration of topics like Unicode text processing and API design — both tangential to the letter-counting problem, but otherwise with a very wide reach, on their own.
Counting things is an apparently trivial computational problem. In this article series — more of a journey than a short single-topic read — I’ll go over the process of producing a letter-based histogram from a piece of text, as a motive to progressively introduce several useful built-in and Standard Library tools. Along the way I’ll share a few tips and thoughts on coding principles, related topics, like unicode text processing, and, for completeness, ideas on possible output production. The key takeaway is that Python has many built-in and Standard Library tools that, used in the right combination, lead to simpler, shorter code, that being correct and easier to understand and manage, will also be faster.