Archive for 'Python'

Making Python code more readable with list comprehensions

This post is added as a reference for myself. As I mentioned previously I’ve been spending a good deal of time learning how to write efficient and readable Python code. Jeff Knupp’s Idiomatic Python videos are absolutely incredible and have definitely helped me become a better programmer. In his first video he turned me on […]

Python generators you had me at first yield

This post is added as a reference for myself. I’ve been reading a lot about writing clean, readable and performant Python code. One feature that I now adore are generators. In the words of Python guru David Beazley a generator is: “a function that produces a sequence of results instead of a single value” The […]

Python console editing with VIM

I’m a long time console guy and haven’t found a graphical Python development tool that suits my needs as well as vim. It takes a couple of amazing vim plug-ins but the experience is great IMHO. I’m currently using the vim-jedi, pylint and vim-syntastic plug-ins which can be installed with yum on CentOS/Fedora machines: $ […]

Reading a file into a Python string

I’ve learned a number of useful things from the Google learn Python video series. One of the tips I got to use today. That tip was Python’s ability to read a file into a string: $ cat foo this is a test file of words $ python >>> f = open(“foo”,”r”) >>> string = f.read() […]

Learn Python video series from Google

I’ve been trying to expand my Python knowledge and recently came across Nick Parlante’s 6-part learn Python series on Youtube. I’ve watched several of the videos, and I am impressed with Nick’s teaching ability. Here are links to the 6-part series: Day 1 part 1: Introduction and Strings Day 1 part 2: Lists, Sorting and […]

Serve out content over HTTP from your cwd immediatly

Ever want to immediatly serve content from a specific directory over HTTP, but didn’t want to bother messing with httpd.conf or other webserver configiurations? If you’ve got Python installed, this is a snap.  Execute python with the SimpleHTTPServer module, using port 8080 so there isn’t a need to elevate privs to root. $ python -m […]

« Older Entries