/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.0
functor.py
30 строк
374 B
ipetrash
Append functor.py
30 май 2018, 09:27
30 май 2018, 09:27
0e80a17
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # Functors class Foo: def __call__(self): return 1 class MySum: def __call__(self, *args): return sum(args) class MyPow: def __call__(self, a, b): return a ** b foo = Foo() print(foo()) # 1 print(MySum()(1, 2, 3, 4)) # 10 print(MyPow()(2, 10)) # 1024