Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing Hints优化 #55

Open
kinegratii opened this issue Feb 5, 2024 · 0 comments
Open

Typing Hints优化 #55

kinegratii opened this issue Feb 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kinegratii
Copy link
Owner

链接:https://peps.python.org/pep-0585/

从 python3.9开始,python类型注解支持使用内置的类型标识参数类型,而不必从 typing 导入。

比如在python3.9之前

from typing import List

def foo(a:List[int]):
    pass

python3.9之后可以这样使用

def foo(a:list[int]):
    pass

具体类型可查看 PEP 585。

@kinegratii kinegratii added the enhancement New feature or request label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant