Python编程:zope.interface实现接口
2023-09-14 09:07:15 时间
pypi : https://pypi.org/project/zope.interface/
文档:https://zopeinterface.readthedocs.io/en/latest/index.html
面向对象中接口负责定义规则,具体实现类来实现规则
安装
pip install zope.interface
代码示例
from zope.interface import Interface
from zope.interface.declarations import implementer
class IHuman(Interface):
def say_hello(self):
"""这个文字没有会报错"""
@implementer(IHuman)
class Man(object):
def say_hello(self):
print("hello")
if __name__ == '__main__':
man = Man()
man.say_hello()
# hello
so: 暂时没发现 zope.interface 的有啥好处
相关文章
- 【华为云技术分享】基于Atlas 200 DK的原版YOLOv3(基于Darknet-53)实现(Python版本)
- 第四百一十二节,python接口,抽象方法抽象类
- Python中生成器和yield语句的用法详解
- python接口自动化5-Json数据处理
- Python 刷Leetcode题库,顺带学英语单词(3)
- NLP之Chatgpt:基于openai框架通过调用API接口实现Chatgpt的吊炸天功能的图文教程(基于python代码实现)、案例应用之详细攻略
- 制作惊艳的可视化动图,ipyvizzu 这款 Python 可视化库不可少
- python numpy数组中冒号 : 的使用--全局选择、表示区间
- Python:企业微信接口封装库work-weixin-api
- Python 使用 Tornado Web 框架写HTTP接口实例代码(异步+线程池)
- 2023年网络安全竞赛——Python渗透测试PortScan.py
- 手把手教你完整Python接口自动化--附源码
- python登录接口测试问题记录与解决 ( 干 货 )
- 如何做好python接口自动化测试,不懂技术的测试改何去何从!
- python lmdb demo 这接口和BDB一样恶心啊!
- Python+request+unittest实现接口测试框架集成实例
- python memcache操作-安装、连接memcache
- 关于OpenCV for Python入门之Dlib实现人脸检测
- 使用Python访问CANoe COM接口实践