Skip to content

{ Category Archives } python

One bit of Python I’ll never get…

>>> “hello”[2:4]
‘ll’
>>> “hello”[2:]
‘llo’
>>> “hello”[:4]
‘hell’
Do any of those not make sense to you? Here’s how I see it, and my confusion;
“hello” represents a 5 character string… and indexing starts at 0, something most programmers are all familiar with. The “[" "]” characters are used to subscript (or index) the string (which is actually a list of [...]

What if stocks were movies?

As you’ve seen from my previous posts, I’ve been playing with python, couchdb and been working my way through the “Programming Collective Intelligence” book. However, what I haven’t been talking about much is what I’ve actually been doing with it!
When learning something, I’m at a disadvantage unless I can relate the technique toward an application, [...]

python & couchdb sample

Lacking any good examples of how to use python’s couchdb module, I’ve managed to make pretty impressive progress (for me) on a 4th of July holiday.
I’ll try to recreated it here for others although I know it’ll be incomplete.
Consider it a syntactical example;
import couchdb
s = couchdb.Server(’http://localhost:5984/’) ##why can’t it default to this?
db = s['stock_values']
ids [...]

Quick mean python bug…

So I’ve been learning some python and love it! It’s highly functional and most of the libraries are “good enough”.
This morning I recently discovered a bug I introduced when testing… not a bug in the class, but a bug in the way Python works against expectations (even if they are just my own).
Let’s say I [...]

Continuing to Code

Well, my python’s not exactly getting prettier but I’ve been able to make it more functional, may I present “find_image_dups.py”!
Although I’m learning this 4G language (is it truly?) I still tend towards a shell scripting approach so I write small bits of code rather then trying to write one script that will both subdivide [...]

Progress in the New Year

Welcome to the New Year! A lot has happened already, between Google changing their page rank, Apple’s numerous announcements and tons of other cool stuff. I’ve been getting back into the swing of things and mostly trying to figure out how to start off the new year right, i.e. if there was some great “first [...]