jython and concatenation of strings

Jan Gregor gregor.jan at NOSPAMquick.cz
Wed Dec 15 12:42:35 CET 2004


StringBuffer class from java was right solution - yours looses encoding,
and in jython I was unable to get it back - in python it worked fine.

Jan

> I don't use Jython, but are you not able to do something like:
>
> string_list = []
> for ... in ...:
>      ...
>      string_list.append(...)
>      ...
> string = ''.join(string_list)
>
> This is the usual Python idiom and is usually faster than the += idiom.
>
> Note too that +ing strings in Java also has this problem -- hence 
> StringBuffer or whatever it's called.
>
> Steve



More information about the Python-list mailing list