Comment by pekka.klarck:
Score: Negative
General Comment:
1) Did you measure that it's faster to write first to StingIO and then to
file? I would assume it's opposite.
2) If you want to collect results like this and only later write them to a
file (or anywhere), it's a better idea to use lists than StringIO. Append
to list ought to be super fast in Python and joining elements once after
collecting all is fast too.
3) In this particular case even lists aren't needed as a generator would do:
result = ''.join(get_matching_char(c) for c in string)
For more information:
http://code.google.com/p/robotframework/source/detail?r=53284ea6e955800c5399ed5028a289370dd4e205