python接口协议
时间: 2023-08-28 20:21:14 浏览: 156
在Python中,接口与协议有着不同的定义和使用方式。接口是对类具有哪些属性的正式定义,它可以由文档和约定来定义。比如,如果一个类实现了__getitem__方法,那么它就符合序列协议的约定,可以完成访问元素、迭代和使用in运算符等操作。这种方式称为猴子补丁。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python中的接口协议和抽象基类](https://blog.csdn.net/weixin_45741835/article/details/120480587)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [python+pytest接口自动化-接口测试基础,http协议基础(一)](https://blog.csdn.net/csdnchengxi/article/details/125483266)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [流畅的python笔记(十一)接口:从协议到抽象类型](https://blog.csdn.net/chk_plusplus/article/details/120935068)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文