commit 4dc0f71a2788ed3530b053c0363738a8964f6a86 author: asatarin date: 2017-10-13T16:14:43+03:00 revision: 3199619 REVIEW:340199 Speed up StringDescription --- contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (94523234ff338f573e50b70f8cf7f6c8456bd3a1) +++ contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (4dc0f71a2788ed3530b053c0363738a8964f6a86) @@ -24,15 +24,14 @@ def tostring(selfdescribing): class StringDescription(BaseDescription): """A :py:class:`~hamcrest.core.description.Description` that is stored as a string. - """ def __init__(self): - self.out = '' + self.__out_list = [] def __str__(self): """Returns the description.""" - return self.out + return ''.join(self.__out_list) def append(self, string): - self.out += six.text_type(string) + self.__out_list.append(six.text_type(string))