Everything I know about Python...

Learn to Write Pythonic Code!

Check out the book Writing Idiomatic Python!

Looking for Python Tutoring? Remote and local (NYC) slots still available! Email me at jeff@jeffknupp.com for more info.


Python, sandman2, and Open Data

sandman2 (and its predecessor, sandman) has been far and away my most successful open source project. I fully attribute this to its genuine usefulness. It is most often used as a command line tool, through which you provide the connection details of a legacy database and run it, and in return it starts both a RESTful API service for your data, as well as a web-based UI that allows you to add, delete, and edit rows directly. For many (especially in the enterprise), interacting with legacy databases is a pain at best, and impossible at worst. The ability to access data via a simple REST API, then, is a godsend.

Read on →


Should Engineering Managers Code?

Note: This post also appears on the blog of my employer, Enigma (enigma.io)

Earlier this year I made a career change: I decided to stop being an Individual Contributor (or "IC", i.e. someone who codes) and became the Engineering Manager of the team I was a member of. I call it a "career change" because it's important to recognize the move for what it is. All too often, such a change is viewed as the logical progression of an engineer's career. That's a shame.

It's a shame because being an engineer trains you to be a people manager about as well as it trains you to be a circus juggler. There are almost no transferable skills, save the domain knowledge you've acquired that will ostensibly help in managing projects. But (as every engineer will tell you), being a great engineer does not mean you'll be even a passable manager. Some companies (like my own) realize this and create parallel career paths for engineers that want to write code forever without mortgaging their advancement opportunities. Sadly, most companies are not so forward thinking.

Read on →


Python with Context Managers

Of all of the most commonly used Python constructs, context managers are neck-and-neck with decorators in a "Things I use but don't really understand how they work" contest. As every schoolchild will tell you, the canonical way to open and read from a file is:

with open('what_are_context_managers.txt', 'r') as infile:
    for line in infile:
        print('> {}'.format(line))

But how many of those who correctly handle file IO know why it's correct, or even that there's an incorrect way to do it? Hopefully a lot, or else this post won't get read much...

Read on →


Improve Your Python: the with Statement and Context Managers

Of all of the most commonly used Python constructs, context managers are neck-and-neck with decorators in a "Things I use but don't really understand how they work" contest. As every schoolchild will tell you, the canonical way to open and read from a file is:

with open('what_are_context_managers.txt', 'r') as infile:
    for line in infile:
        print('> {}'.format(line))

But how many of those who correctly handle file IO know why it's correct, or even that there's an incorrect way to do it? Hopefully a lot, or else this post won't get read much...

Read on →