python高级写法学习

python 复制代码
plugin_container, class_container, base_class = {
   'trigger': (self._trigger_plugins, self._trigger_classes, BaseTrigger),
   'jobstore': (self._jobstore_plugins, self._jobstore_classes, BaseJobStore),
   'executor': (self._executor_plugins, self._executor_classes, BaseExecutor)
}[type_]

首先是定义一个字典,取字典的value,然后是元组解压

也就是说,type_的值只能是trigger、jobstore、executor,

plugin_container, class_container, base_class的值将是self.xx_plugins, self.xx_classes, xx

例如:type_='executor',

那么plugin_container, class_container, base_class=(self._executor_plugins, self._executor_classes, BaseExecutor)

相关推荐
允许部分打工人先富起来12 分钟前
在node项目中执行python脚本
前端·python·node.js
IVEN_16 分钟前
Python OpenCV: RGB三色识别的最佳工程实践
python·opencv
haosend1 小时前
AI时代,传统网络运维人员的转型指南
python·数据网络·网络自动化
曲幽1 小时前
不止于JWT:用FastAPI的Depends实现细粒度权限控制
python·fastapi·web·jwt·rbac·permission·depends·abac
IVEN_19 小时前
只会Python皮毛?深入理解这几点,轻松进阶全栈开发
python·全栈
Ray Liang20 小时前
用六边形架构与整洁架构对比是伪命题?
java·python·c#·架构设计
AI攻城狮20 小时前
如何给 AI Agent 做"断舍离":OpenClaw Session 自动清理实践
python
千寻girling20 小时前
一份不可多得的 《 Python 》语言教程
人工智能·后端·python
AI攻城狮1 天前
用 Playwright 实现博客一键发布到稀土掘金
python·自动化运维