Zubin Mithra wrote:
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
The best practice is to care more about your coding style (i.e. how you make your code easy to read & understand) than pointless speed optimization. If you *really* care about speed, maybe you shoud use something else than python.

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

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

Reply via email to