Google's Python Style Guide

http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

Continue reading »

I just *want* to be a programmer

stumbled across the FizzBuzz quest thanks to fellow dad Jeff Atwood.

I spent about 8 minutes on this mainly because I always forget / vs %, and iteration through if blocks. Here is my fizzbuzz in Python.

for i in range(0,100):  
    j = i % 3  
    k = i % 5  
    if j == 0 …

Continue reading »

Python: ‘==’ not the same as ‘is’

my good friend Chris P. was helping me with some python debugging and he pointed this thread out to me on the python Tutor list.

Thank you Chris for your patience and Python guru help. :)

Continue reading »

python stuff

from vegaseat at DaniWeb.Com.

Python Code Snippet (Toggle Plain Text) # handling date/time data # Python23 tested vegaseat 3/6/2005

import time

print "List the functions within module time:"
for funk in dir(time):
print funk

print time.time(), "seconds since 1/1/1970 00:00:00"
print time …

Continue reading »

Programmers 10 Commandments

taken from: Dirk's Junk Box.

The Programmer's 10 commandments
Tue, 03/04/2008 - 22:49 — Dirk
After more than a decade in the IT Industry, I have found, that few junior programmers make a success of their careers. Below I list what I consider the 10 commandments of a programmer …

Continue reading »

Debugging python...

To debug a specific python script, start by inserting the following in to your .py file:

import pdb; pdb.set_trace()

These commands allow you to step through the code from the point of where pdb.set_trace() is placed in your script.

p \<object> - print the content of an …

Continue reading »

Merge lists in to dictionary based on key in Python

i've been learning bits of python here and there for work and for play and I came across a simple solution to a simple problem I had to solve in python.
There are some things in python that once you realize how things work you think "that is so simple …

Continue reading »