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.
The other day, while reviewing the Assignment Section exercises for a training course I was about to deliver, wanting to type dir() into a Python REPL, my fingers went for del() instead. At first I didn’t even notice it but then, something in the back of my head called …
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.
An introduction to Python Virtual Environments. What they are, why they’re useful and, for those with an interest, and to a certain extent, how they work. Both beginners and seasoned Pythonistas should be using Virtual Environments. Read on, and decide for yourself.