/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/python/std_vector/runme.py
33 строки
588 B
William S Fulton
Modify examples to be both Python 2 and 3 compatible
15 авг 2020, 18:46
15 авг 2020, 18:46
89bee6a
Код
Авторство
О чём код?
# file: runme.py import example # Call average with a Python list... print(example.average([1, 2, 3, 4])) # ... or a wrapped std::vector<int> v = example.IntVector(4) for i in range(len(v)): v[i] = i + 1 print(example.average(v)) # half will return a Python list. # Call it with a Python tuple... print(example.half((1.0, 1.5, 2.0, 2.5, 3.0))) # ... or a wrapped std::vector<double> v = example.DoubleVector() for i in [1, 2, 3, 4]: v.append(i) print(example.half(v)) # now halve a wrapped std::vector<double> in place example.halve_in_place(v) print([i for i in v])