more efficient?

Zubin Mithra zubin.mithra at gmail.com
Tue Dec 22 01:13:38 EST 2009


I have the following two implementation techniques in mind.

def myfunc(mystring):
    check = "hello, there " + mystring + "!!!"
    print check


OR
structure = ["hello, there",,"!!!"]
def myfunc(mystring):
    structure[2] = mystring
    output = ''.join(mystring)

i heard that string concatenation is very slow in python; so should i
go for the second approach? could someone tell me why? Would there be
another 'best-practice-style'?
Please help. Thankx in advance!

cheers!!!
Zubin



More information about the Python-list mailing list