Transforming Code into Beautiful, Idiomatic Python

Channel:Next Day Video · Length:48:51 · Published:2013-03-21 · Views:1094212

Watch on YouTube

Summary

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.

Why HN recommends it

HN treats it as a must-watch classic for writing Pythonic code, though somewhat dated for modern Python.

the excellent talk "Transforming Code into Beautiful, Idiomatic Python". — HN, 2021

Python, Ruby & scripting languages · Software practice, open source & careers

Subtitles (excerpt)

you can be sure you're getting the straight story or they will correct me right in the middle so this was labeled a novice talk an intermediate talk and an advanced talk Al together I've uh I put some of each in uh it's got a lot of code in it you don't have to memorize it as it uh goes by I'll actually give you all my slides they're already uploaded they are actually meant to be something that you take back to work and use immediately go through all your codebase and find every where I said don't do this do this instead and swamp it and your code will be beautiful faster more idom and more pythonic and less like C Java C++ and other languages not that those languages are bad they just have different idioms uh uh than we have uh I'm curious how many people in the audience have uh taken a class from me at one point wow I'm I've uh taught over a thousand engineers in the uh uh last year and I've gained an appreciation for what things are really beautiful in Python works great for people so it looks like I've got a number of former students here how many perspective students none oh okay lots of them good enough and as all of my students know practically every example starts out with Raymond equal red Rachel equal blue

On Hacker News

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] - [VIDEO] — jka, 2021-01
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] [VIDEO] — bhoeting, 2017-11
Must watch: [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. — clusmore, 2017-01
For an alternative perspective, allow me to present some classic talks from Raymond Hettinger. First, some generic tips on how to write Python code that's pleasant to work with: [VIDEO] And then this one digs more specifically into how not to write Python like it's Java, starting at 12:40 (with talking about why leading up to that): [LINK] — mumblemumble, 2022-05
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 [VIDEO] — greggyb, 2021-11

Related videos