py-modern
Installation
SKILL.md
Python 3.12+ / 3.13+ 現代語法與特性
Quick Start(30 秒上手)
# Python 3.12+ 新型態參數語法(PEP 695)
type Point = tuple[float, float]
def first[T](items: list[T]) -> T:
"""回傳列表中的第一個元素"""
return items[0]
class Stack[T]:
"""泛型堆疊"""
def __init__(self) -> None:
self._items: list[T] = []
def push(self, item: T) -> None:
self._items.append(item)