On 10/2/2010 12:09 PM pyt...@bdurham.com said...

Your times will improve when not burdened by the repeated method lookups and element-wise list creation:

try with eg,

def testListAppend2():
    output = list()
    append = output.append
    for char in source:
        append( char )
    output = ''.join( output )

and even further with

def testListAppend3():
    output = list(source)
    output = ''.join( output )

Same with:

def testStringIO2():
    output = cStringIO.StringIO()
    write = output.write
    for char in source:
        write( char )
    output = output.getvalue()

Emile


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to