[Python-ideas] Create a StringBuilder class and use it everywhere

Stefan Behnel stefan_ml at behnel.de
Thu Aug 25 17:15:40 CEST 2011


Steven D'Aprano, 25.08.2011 16:00:
> Python already has a "build strings efficiently" idiom:
> ''.join(iterable_of_strings)
>
> If people can't, or won't, learn this idiom, why would they learn to use
> StringBuilder instead?

Plus, StringBuilder is only a special case. Joining a string around other 
delimiters is straight forward once you've learned about ''.join(). Doing 
the same with StringBuilder is non-trivial (as the Java example nicely shows).

Stefan




More information about the Python-ideas mailing list