
May 1, 2020
6:56 a.m.
01.05.20 01:23, Paul Ganssle пише:
class LazyList: def __init__(self, some_iterator): self._iter = some_iterator self._list = None
@call_once def as_list(self): self._list = list(self._iter) return self._list
call_once is not applicable here, because it is only for functions which do not have arguments, but as_list() takes the self argument.