python新功能match case|:=|typing
多年以后我意识到一个道理,无论多新的技术,多年以后都会变得过时,而想要不过时也很简单,那就是保持学习,保持更新。
我的python专栏从2016年开始写,到如今也快十个年头了,中间断断续续,却也一直持续下来了。
在看学习mini-swe-agent源码的时候学到了三个新知识,不过是三个术,而不是道,想要学到道,术是必不可少的过程。别为了学而学,为了解决问题而学。
match case语法
在我的印象中,确实没有遇到过
功能和if else类似,和其他编程语言中的switch类似。
match variable:case pattern1:# Code block for pattern1case pattern2:# Code block for pattern2case _:# Default case (like 'else')
typing模块
typing: Support for type hints
Note The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc.
from typing import Any, Protocol
:=运算符
what’s this?
华为云的:对象存储服务 OBS