본문 바로가기
프로그래머/프로그래밍

파이썬 점세개 python ... 의미 (ellipsis)

by plog 2023. 11. 21.

python ...

파이썬에서 Ellipsis(...) 객체는 영어 뜻 대로 생략, 줄임 등으로 사용된다. 다차원 데이터 배열을 쉽게 처리 할 때 사용 된다. FastAPI 프레임워크를 사용 하면서 자주 쓰는 것 같습니다. 

 

예제

>>> a = [1, 2, 3, 4, 5, 6]
>>> a[...]
[1, 2, 3, 4, 5, 6]


>>> b = [[1, 2, 3], [4, 5, 6]]
>>> c = np.array(b)
>>> c[...]
array([[1, 2, 3],
       [4, 5, 6]])

 

def get_record(
    season: int = Path(..., title="시즌", description="YYYY", example=2023)
    , game: int = Query(..., title="게임", description="number", example=1)
):

댓글