상세 컨텐츠

본문 제목

파이썬 3.10부터는 switch/case같은 match/case 구조적 패턴 매칭 사용 가능

PYTHON

by 이를루 2023. 9. 8. 15:07

본문

파이썬 3.10부터 C의 switch/case와 같이 인지하기 좋은 구조적 패턴 매팅이 사용가능하다고 합니다.

 

C:    switch / case

 

파이선 구 : if else elif 의 루프

 

파이썬 3.10 :  match / case

 

https://www.itworld.co.kr/news/303895

 

“마침내 파이썬에서도 흐름 제어를” 구조적 패턴 매칭을 사용하는 방법

파이썬은 강력하고 인기 있는 언어지만, 다른 언어에 있는 흐름 제어, 즉 값을 취해서 가능한 여러 조건 중 하나와 매끄럽게 매칭하는 방법이 오랫

www.itworld.co.kr

 

https://docs.python.org/3.10/reference/index.html

 

The Python Language Reference — Python 3.10.12 documentation

 

docs.python.org

https://docs.python.org/3.10/reference/compound_stmts.html#the-match-statement

 

8. Compound statements — Python 3.10.12 documentation

8. Compound statements Compound statements contain (groups of) other statements; they affect or control the execution of those other statements in some way. In general, compound statements span multiple lines, although in simple incarnations a whole compou

docs.python.org

 

'PYTHON' 카테고리의 다른 글

파이썬 입력에서 x_data, y_data 분리하기(w/ 슬라이싱)  (0) 2022.03.30
[팁] Python 코딩 실수들  (0) 2022.03.07

관련글 더보기