3 Easy Ways to Stick to a Coding Standard

When you're writing python, you don't need a lot of debate over the minutiƦ of most coding standards. PEP 8 does that for you. Even better, there are some tools that make it really easy to stick to the standard.

Why do this? Well, for one thing it ...

Hassle Free Way to Kill Sudo'd Jobs

Every now and then I have to run a foreground job under sudo that doesn't want to die when I hit ^C. Then it's a hassle to ^Z, get the pid of the sudo job, and sudo kill that pid.

So I wrote a little script (or a ...

Using Python's ctypes to Call Into C Libraries

The ctypes module makes loading and calling into a dynamic library incredibly easy:

>>> from ctypes import CDLL
>>> libc = CDLL('libc.so.6')
>>> print libc.strlen('abcde')
5

As with everything else in python, it gets even better when you scratch the surface. In the example above, CDLL returns an object ...

Yet Another Python Enum Module

I didn't like the existing enum recipes, so I cooked up what I feel is a better way of working with enumerations in python. The result is yapyenum, hosted on github. Rather than come up with something new to say about it, I'll just repost the README here ...

« Page 12 / 19 »