Everything I know about Python...

Learn to Write Pythonic Code!

Check out the book Writing Idiomatic Python!

Discuss Posts With Other Readers at discourse.jeffknupp.com!

The Writing Idiomatic Python Book is Finally Available!

It took far more effort and time than I ever anticipated, but the Writing Idiomatic Python eBook is finally available! It's in "beta" mode right now, meaning I'm still planning on adding more content over the next month, but if you get it today you'll automatically get all of the updates (and corrections) for free. I really believe that the book will be of use to both those new to Python and those looking to increase their Python mastery.

Behind the scenes

Interestingly, the book has its own automated build and test process, and it's the most comprehensive I've ever used on a Python project. As the book is primarily comprised of code samples, regression testing is an absolute must. I'm using pytest to implement the tests themselves. I found it a bit more flexible than nose in terms of deciding which directories/files/functions should be searched for tests. I'm also using the coverage package to make sure all of the code samples are actually being tested properly.

Read on →


Creating and Optimizing a Letterpress Cheating Program in Python

I first discovered the iOS game Letterpress while reading Marco Arment's The Magazine (Letterdepressed, Josh Centers, Issue 5). I installed it immediately after finishing the article and was instantly hooked. It's a compelling mix of strategy and vocabulary demonstration. Easier to learn and quicker to play than Scrabble, while still providing a means for Liberal Arts majors to demonstrate superiority over their gainfully employed peers, if only for a few minutes.

A few days ago, I needed a distraction from finishing my upcoming book. Writing a Python based Letterpress "assistant" cough seemed like a fun diversion. I started with code originally written for Scrabble, but it was painfully slow. In this post, I'll show how I optimized and refactored the original code to the point that it's actually useful for Letterpress.

Read on →


Learning Python via Django Considered Harmful

I learned to program in Python indirectly. I was interested in learning about web application development and heard good things about Django. I didn't know Python, but the syntax and documentation looked straightforward enough. Like any reasonable programmer, I figured the language didn't matter and I would pick it up as I went.

Largely, this was true. Python proved to be quite learnable, and I was quickly productive on my Django project. It wasn't until long after the project was completed that I realized I hadn't actually learned Python. I had learned some odd mutant hybrid language: part Python, part Django. Using Django to learn Python is a terrible way to actually learn Python.

Read on →


Linkrdr Rises From the Ashes

In the beginning of 2012, I developed a site called Linkrdr. It was designed to be "the next generation RSS reader." Instead of simply listing each item in your RSS feeds in chronological order, it would: scan their content, extract links it found, then intelligently rank all of the links from all new entries and display them accordingly.

The idea was, if I subscribe to TNW and TechCrunch and they both have a write up of the same story, I'd rather see the link they're talking about than two entries from secondary sources. As you interacted with it, Linkrdr learned your preferences and factored them in to its rankings. The result: a personalized list of interesting links, with some traditional RSS reader functionality to boot.

The system worked, but faced some scaling challenges. Users could import their feeds from other sources, and some had hundreds of feeds they followed. This meant the content retrieval and analysis process had a ton of work to do, even for a relatively small number of users.

But the main issue was I was solving a problem that didn't exist for very many people. Those that understood it and had a large number of feeds found it really helpful. Most, however, didn't get it and weren't particularly unhappy with the way they consumed RSS feeds. It solved a problem they didn't have.

Read on →


Blog Redesign: Focusing on Microdata

If you're a regular reader of this blog and visited in the past few days, you likely noticed a dramatic difference in the blog's look and feel. The HTML for this blog has been generated by Blug, the static site generator I wrote, since about July. Previously, I was using Octopress and was generally happy with it.

So was every other technical blogger on the planet.

Read on →