conda create -n py313 python=3.13 conda activate py313
def is_str_list(obj: list[object]) -> TypeIs[list[str]]: return all(isinstance(item, str) for item in obj) data: list[object] = ["a", "b", 3] if is_str_list(data): # In this block, mypy knows data is list[str] reveal_type(data) # list[str] Building on Python 3.11’s improved tracebacks, 3.13 introduces an interactive exception explanation system.
p: Point = "x": 10, "y": 20 p["y"] = 30 # OK p["x"] = 40 # Type error: "x" is read-only Inspired by TypeScript’s is operator, TypeIs allows user-defined type predicates.
Happy coding – and may your loops be ever faster.
from typing import TypedDict, ReadOnly class Point(TypedDict): x: ReadOnly[int] y: int
conda create -n py313 python=3.13 conda activate py313
def is_str_list(obj: list[object]) -> TypeIs[list[str]]: return all(isinstance(item, str) for item in obj) data: list[object] = ["a", "b", 3] if is_str_list(data): # In this block, mypy knows data is list[str] reveal_type(data) # list[str] Building on Python 3.11’s improved tracebacks, 3.13 introduces an interactive exception explanation system.
p: Point = "x": 10, "y": 20 p["y"] = 30 # OK p["x"] = 40 # Type error: "x" is read-only Inspired by TypeScript’s is operator, TypeIs allows user-defined type predicates.
Happy coding – and may your loops be ever faster.
from typing import TypedDict, ReadOnly class Point(TypedDict): x: ReadOnly[int] y: int
ZTE MC7010 [ Poland ] 396270B0479PLY_PL_MC7010V1.0.0B04.zip