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)

相关推荐
软件黑马王子25 分钟前
C#系统学习第八章——字符串
开发语言·学习·c#
悠悠小茉莉30 分钟前
Win11 安装 Visual Studio(保姆教程 - 更新至2025.07)
c++·ide·vscode·python·visualstudio·visual studio
m0_625686551 小时前
day53
python
Real_man1 小时前
告别 requirements.txt,拥抱 pyproject.toml和uv的现代Python工作流
python
站大爷IP2 小时前
Python文件操作的"保险箱":with语句深度实战指南
python
运器1232 小时前
【一起来学AI大模型】算法核心:数组/哈希表/树/排序/动态规划(LeetCode精练)
开发语言·人工智能·python·算法·ai·散列表·ai编程
strongwyy3 小时前
蓝牙墨水屏上位机学习(2)
学习
九皇叔叔3 小时前
(3)手摸手-学习 Vue3 之 变量声明【ref 和 reactive】区别
学习
巴里巴气4 小时前
selenium基础知识 和 模拟登录selenium版本
爬虫·python·selenium·爬虫模拟登录
19894 小时前
【零基础学AI】第26讲:循环神经网络(RNN)与LSTM - 文本生成
人工智能·python·rnn·神经网络·机器学习·tensorflow·lstm