每一代新出值得注意的新語法筆記一下
文件還在寫,目前看起來主要是效能上的改進
with (CtxManager() as example):
...
with (
CtxManager1(),
CtxManager2()
):
...
with (CtxManager1() as example,
CtxManager2()):
...
with (CtxManager1(),
CtxManager2() as example):
...
with (
CtxManager1() as example1,
CtxManager2() as example2
):
# 變成
with (
CtxManager1() as example1,
CtxManager2() as example2,
CtxManager3() as example3,
):
終於有 switch 了
CodingManFri, Oct 29, 2021 3:54 PM
def http_error(status):
match status:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case 401 | 403:
return "qqqqq"
case _:
return "Something's wrong with the internet"
def square(number: int | float) -> int | float:
return number ** 2
isinstance(1, int | str)
再也不用 import typing
CodingMan
from typing import List
def greet_all(names: List) -> None:
# your code here
def greet_all(names: list[str]) -> None:
# your code here
依每個人喜好或心情不同,自由選擇
Jan 31, 2024共通原則 戒飲料 高糖 戒牛奶 高乳糖 可以使用奶精球代替
May 12, 2022:::danger 註1: 此手冊僅支援 0.8.36,如果你使用 0.8 版本,請更新至 0.8.36 後再參考手冊 註2: 有出現在本手冊中的使用者或文章,如果不想出現,很抱歉請馬上告知我 註3: 此版本程式碼已經停止更新,如有修正將會更新在 0.9 或更新版本 註4: 如果你使用的是 0.9.x,請參考 使用手冊 0.9 ::: 有任何問題都可以直接問我 Github: PyPtt
Mar 5, 2020or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up