pascalabcnet/bin/Lib/SPython/itertools.pys
Александр Земляк 51e4ae050a
Перемещение модулей SPython в Lib\SPython (#3371)
* Replace languageCaseSensitive by languageName data in PCU and caseSensitive parameters in Compiler functions

* Implement SearchDirectories filling in Compiler and move SPython standard modules to their new directory

* Implement search using current language extension first in Compiler

* Delete LibForVB folder and update TestRunner to support different Lib dirs

* Update installer scripts to create separate Lib folder for SPython

* Take into account Lib dirs not found

* Delete supportedSourceFiles variable in Compiler

* Delete unused functions from LanguageIntegrator
2026-01-13 08:20:13 +03:00

32 lines
975 B
Plaintext

# объединяет списки целых в один
def chain(*args: list[int]) -> list[int]:
sz = 0
for arg in args:
sz += len(arg)
res = [0 for i in range(sz)]
i = 0
for arg in args:
for j in range(len(arg)):
res[i] = arg[j]
i += 1
return res
# если вызвать как repeat(10, times=12)
def repeat(val: int, **kwargs: int) -> list[int]:
times = 1
if 'times' in kwargs.get_keys():
times = kwargs['times']
return [val for i in range(times)]
# если вызвать как repeat(10, 12)
def repeat(val: int, times: int) -> list[int]:
return repeat(val, times=times)
# можно просто так
# return [val for i in range(times)]
# просто функция, чтобы показать как итерироваться по kwargs
def print_int_kwargs(**kwargs: int):
for key, value in kwargs:
print(f'kwargs[{key}] = {value}')