On 12/06/2021 04:02, Jach Feng wrote: >>>> def foo(): > ... # do something > ... >>>> a = [] >>>> for i in range(3): > ... a.append(foo()) > ... >>>> a > [] The most natural way to achieve something similar is to replace append() with extend(): >>> def foo(): return () >>> a = [] >>> for i in range(3): a.extend(foo()) >>> a []