Bob> The "to = to + c" line strikes me as not being efficient. Python Bob> creates a new copy of "to" every time it appends "c" to the Bob> end. One common, pure-python fix is: Bob> to = [] Bob> for ... Bob> ... Bob> to.append( c ) Bob> return "".join(to) This common case was sped up in Python 2.5. Skip