Last week I attended the Boston Meetup for Python programmers. About 35 people packed into the attic of betahouse to hear Ned Batchelder’s talk, “A Whirlwind Excursion through Python C Extensions“. The talk, while it gave me a crick in my neck, was brief, informative, and took away some of the mystery surrounding the C underbelly of python.
I won’t give away any spoilers, but there were a couple of items that came up in the talk that weren’t in the slides.
- Writing C extensions for python is a lot like creating the python language itself.
- Actually, it’s the same as writing the python language itself.
- That means that you can look at the python source code for help and ideas.
- When writing extensions in C, you have to think like a python programmer. You still have to do all the C-things that you would normally have to do (e.g. manage memory), but you have to understand how objects are going to be used in their native, pythonic, context.
- When using ctypes in python, you have to think like a C programmer.
- Ned’s talk didn’t cover anything to do with IronPython and Jython
All in all, a very useful primer. If you’re interested, Ned will be giving the same talk at PyCon.

