I’ve been playing with some Python recently ( I will write more about that in a future post ) and there are two things that still trip me up on a regular basis.

The first issue I’ve run into is following Python style ( aka PEP 8 ). Honestly, I’m just not excited about putting in the work to make sure I’m following all of the guidelines. I’d rather let the computer deal with that busy work. Enter: Black.

Black is “the uncompromising Python code formatter”. While it is still listed as beta, I’ve been very happy with it so far. I let it take care of cleaning up the various style items that I’ve missed.

If getting Python style just right doesn’t excite you, I recommend trying out Black.


The second issue is having spaces/indentation be significant. I finally made a small change to my Python code to adjust my Vim setup. I add this to the top of the file:

# vim: expandtab

That tells Vim to expand a tab into spaces.

I still don’t think having spacing be significant in source code is a good idea. However, the above setting has made my “editing Python code with Vim” experience less frustrating.