Programming eloquence
In Chapter 1 of Learning SQL, Beaulieu introduces the idea of thinking in sets and using declarative queries to interact with relational data (Beaulieu, 2020). When we contrast this with the Pandas tutorials (“Ten Minutes to Pandas” and “Intro to Data Structures”), we see that Python’s pandas library adopts a similar mindset: rather than looping through rows manually, we work with entire DataFrames or Series at once, applying vectorized operations that are both efficient and expressive. For example, instead of iterating through each value in a column to apply a transformation, we can write df['col'] = df['col'] * 2, which is clearer and faster. This parallels how in SQL you would update a whole column in one statement. Likewise, Chapter 8 of Think Python emphasizes string methods and slicing, encouraging learners to treat strings as sequences and use built‑in methods like upper(), split(), or join() rather than writing cumbersome loops.
Get Patrick Lynch’s stories in your inbox
Join Medium for free to get updates from this writer.
The philosophy behind these tools aligns with what Miyamoto Musashi once wrote: “Under the sword lifted high, There is hell making you tremble. But go ahead, And you have the land of bliss.” Learning SQL, mastering pandas, and writing in the Pythonic way is a blissful land; code that is elegant, efficient, and maintainable. Yet, it is only possibly once one has pushed through the initial discomfort of the jargon and foreign concepts, the proverbial sword, navigating the linguistic landscape and conceptualizing of idiomatic approaches.
The Pythonic way, as outlined in the Zen of Python (Peters, 2004), is about clarity and simplicity, leveraging the language’s strengths rather than fighting against them. In both learning and practice, taking a step forward despite the initial challenge is thoroughly reflected in Miyamoto’s quote: chih chu 直走, go straight ahead. Say what needs to be said, but yield to elegance.
My question for you: When working with SQL or Pandas, what elegant or efficient ways have you found to code? Or just in general, is there anything that strikes you as especially artistically simple in python?







