def _split(self, obj): # "hello there world" -> ["hello", "hello there", "hello there world"] from itertools import accumulate return list(accumulate(obj.split(), lambda x, y: f'{x} {y}'))