Beyond PEP 8

Beyond PEP 8 -- Best practices for beautiful intelligible code is another great talk by the Python-famous Raymond Hettinger. Each year at Pycon US Mr. Hettinger manages to teach a roomful of experts and novices something useful. This is an incredibly difficult thing to do. His most recent Pycon talk about PEP8 provides key insights for beginners and seasoned veterans alike as he focuses on the practice of 'PEP8-ing' code.

I'm sure you're familiar with this term if you've worked a Python application with more than 1 developer in the past. Typically a newcomer on the project will try to get involved and go around cleaning up whitespace, line lengths, and other miscellaneous things that tools like Pylint complain about. As Mr. Hettinger points out, this can be useful. It can also contribute to the superficial score Pylint gives your code. Unfortunately, these PEP8-ing sessions can lead to subtle bugs.

So, Mr. Hettinger's talk is not about this kind of PEP8-ing. Instead he focuses on how to modify and simplify existing code to conform to more Pythonic standards. These standards aren't represented in PEP8, but they are arguably more important to code quality. I don't want to give anything away so you'll have to watch the talk. Do yourself a favor and spend 50 minutes today watching Mr. Hettinger walk you through transforming a Java API into a clean Python API. You'll probably be surprised at how useful his tips are for your own code.

Language empowers thought

Take some time and read thisinterview with Aaron Maxwell, the author of the Advanced Python Newsletter. The interview revolves around Python because that's what Aaron Maxwell specializes in. However, there are some real gems here even for non-Python developers.

This matters, because language empowers thought. Code is not just a way to control a machine. It becomes a basic medium in which we express the mental creativity of our craft. A language can hinder or support that expression. A lot of it depends on making good decisions on details of the language.

That's why developers, whether they know it or not, identify with a specific language and bicker over what language is better.

Using to enforce import order

Take a few minutes on your Friday to read this article on simple rules for building great Python packages.

It's never dawned on me the usefulness of using to enforce the import order of submodules. You might be able to even use this tactic to avoid circular dependencies in a cleaner way than imports inside functions, etc.

GitHub – durden

Luke Lee

Dresden, Germany

Over the last 10 years, Luke Lee has professionally written software for applications ranging from ...