Transforming Code into Beautiful, Idiomatic Python
Why Hacker News recommends it
HN treats it as a must-watch classic for writing Pythonic code, though somewhat dated for modern Python.
What it is
Raymond Hettinger's PyCon 2013 talk on transforming code into idiomatic Python through a series of before-and-after refactorings. It shows how to use iterators, dictionaries, named tuples and other language features well.
Recommended by 9 HN commenters across 9 different months, 2014 to 2022.
What Hacker News said
Strong rec clusmore · 2017-01 · on “Origins of Python's “Functional” Features (2009)”
Must watch: [this video] I believe that the list comprehension will be faster than filter, but as always, any time you replace readable code with unreadable code for performance reasons, you damn well better time it.
Strong rec bhoeting · 2017-11 · on “Ask HN: Which programmer do you look up to?”
I've never heard of Raymond Hettinger before but I'm currently watching one of his videos [1] and it's amazing. Thanks for sharing your list, I'll definitely look up some more of these people. [1] [this video]
Strong rec jka · 2021-01 · on “Software engineering topics I changed my mind on”
Your mention of simple and clean code makes me think of the excellent talk "Transforming Code into Beautiful, Idiomatic Python". Although it relates to Python programming, if the ideas and principles (and thoughtfulness and pace) from it could be applied to much more written code, then (I think) we as an industry and all our users would be in a better place. [1] - [this video]
Recommends kriro · 2014-03 · on “Python Language Features and Tricks”
Great suggestion. Just searched for him on youtube and a couple of excellent looking talks popped up. Halfway through and this one seems great so far: [this video] Really enjoy his style as well :)
Recommends msvalkon · 2014-07 · on “Anti-Patterns in Python Programming”
Check out Raymond Hettingers Transforming Code into Beautiful, Idiomatic Python talk on youtube [1]. Great talk on avoiding some of the common pitfalls new python developers step in. Exposes some nice language features. [1]: [this video]
Recommends shackenberg · 2014-11 · on “Python idioms I wish I'd learned earlier”
If you were underwhelmed by this blog post have a look at: Transforming code into Beautiful, Idiomatic Python by Raymond Hettinger at PyCon 2013 [LINK] and [this video] Topics include: 'looping' with iterators to avoid creating new lists, dictionaries, named tuples and more
Recommends kzrdude · 2021-05 · on “Writing Pythonic Rust”
Raymond Hettinger's talks are great. I know it's not a succint blog post, but they are out there are watching a video is very approachable. Maybe [LINK] (Dataclasses! We could cheekily say Python gets better at something Rust does - dataclasses makes Python better at records.) And [LINK] This talk (2013): [this video] Unfortunately this video is now a bit out of touch with modern Python. Another (2013) classic: [LINK] it is very well known, and it has the very memorable advice: what's a class that only has one method? That should be a function!
Recommends greggyb · 2021-11 · on “Your users will do what you make easy”
These are a few videos which present Pythonic style. They do not form a proper curriculum, but they are example-heavy and give a good insight to a very Pythonic mind. 1. Beyond PEP 8 [LINK] 2. Transforming Code into Beautiful, Idiomatic Python [this video]