Possibility and Probability

Python, AI, and other fun stuff

5/19/2004

Color coding my Python examples

I was looking back over what I've written so far and it really stuck me how *blah* my code examples where in previous postings. They were almost indistinguishable from the text surrounding them. So I journeyed over to the Python cookbook to see how they HTML-ize the code examples there.

I found the coolest recipe that shows how to do it. A few quick modifications to put my stomach churning colors in place (everyone complains about this color scheme, I liked it and used it for a long time. Nowadays I use a black background instead of the dark blue.). Now hopefully code examples like this:
#!/usr/bin/env python
#
#       hello.py
#
#       A quick hello world application in python
#

if __name__ == "__main__":
        print "Hello world!"
Now isn't that better? If nothing else it sticks out like the proverbial sore thumb....

Comment on this post [ so far] ... more like this: [python]