Thursday, December 11, 2008

Revisiting Google’s Python Style Guide

I like code style guidelines. When properly done, it just gives you that warm, fuzzy feeling of consistency. We’ve been working with Python here, but each of us has been hacking in a slightly different style.

Subconsciously, I've been longing for Google's internal python style guide. I remembered it as a good balance of dos and donts. It errs on the side of readable code, fewer power features, and promotes a nice naming scheme. It covers more ground than PEP-8. Thus, instead of trying to make up my own, I searched the Internets and found this gem here. It’s essentially a copy of Google’s Python style guidelines, slightly modified for one of the Summer of Code projects!

In my previous job, people sometimes accused me of trying to clone Google processes. I always saw that as a compliment. Still, I adjusted the guidelines to what we’re building. One thing about that guide annoyed me in particular: 80 chars per line!? It's 2008, people have widescreen monitors! We upped the ante on that one.


Dan said...

Aren't you breaking your NDA by saying this? :-) Dan

Gabor said...

Not really, they say that this is their style guide on the Summer of Code site I link to.


Mason said...

those styleguides are a great resource--i wish they were all public so we could still use 'em.

Gabor said...

They're semi-public. As I mentioned in the article, a version of the style guide is here:

Google's Python Style Guide