/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
inspect__examples/is_function.py
34 строки
498 B
gil9red
Refactoring. Using black code style
26 май 2023, 15:52
26 май 2023, 15:52
5d7835d
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" import inspect def foo(): return 1 class Foo: def __call__(self): return 1 print(inspect.isroutine(lambda: 1)) # True print(inspect.isroutine(foo)) # True print() # Functor foo = Foo() print(inspect.isroutine(foo)) # False print(hasattr(foo, "__call__")) # True print(callable(foo)) # True print() import math print(inspect.isroutine(math.sin)) # True print(inspect.isroutine(print)) # True