1 분 소요

 안녕하세요 마개입니다.
Python 3.10 버전에서의 변경사항에 대해 알아봅니다.


image



메이저 변경사항

새로운 구문

  • PEP 634 (Structual Pattern Matching: Specification) : 파이썬 버전 Switch Case로 파이썬에서는 match-case 구문임.
  • PEP 635 (Structual Pattern Matching: Motivation and Rationale) : match-case 구문의 동기와 이론
  • PEP 636 (Structual Pattern Matching: Tutorial) : match-case 구문 튜토리얼
  • BPO-12782 (Parenthesized context managers are now officially allowed) : with 구문이 여러 줄의 괄호 구문을 지원


기본 라이브러리의 새로운 특징

  • PEP 618 (Add Optional Length-Checking To zip) : zip함수 구문을 이용할 경우 데이터의 길이를 체크할 수 있음. strict를 True로 설정할 경우 이터러블 중 하나가 먼저 소진되면 에러 발생.


Interpreter 개선

  • PEP 626 (Precise line numbers for debugging and other tools) : 디버깅과 다른 툴들을 위한 정확한 line 번호로 trace를 실행했을 때 실행되는 코드의 모든 라인이나 실행되는 코드 라인을 보여주고 에러발생시 정확한 위치를 제공함.


새로운 typing 특징

  • PEP 604 (Allow writing union types as X | Y) : Union[X, Y] 형태를 | 연산자를 이용해 X | Y 로 사용가능함. isinstanceissubclass 호출에 나올 수 있음.
  • PEP 612 (Parameter Specification Variables) : typing.ParamSpectyping.Concatenate 를 사용하면 호출 가능한 객체에 추상적인 타입 정의 정보를 주석달 수 있음.
  • PEP 613 (Explicit Type Aliases) : 변수에 type을 이용해 선언할 수 있음. 잘못된 타입이 있을 경우 구별이 가능함.


중요한 지원 중단, 삭제, 제한 사항들

  • PEP 623 (Deprecate and prepare for the removal of the wstr member in PyUnicodeObject)
  • PEP 632 (Deprecate distutils module) : distutils 패키지 대신 Setuptools 패키지를 사용할 것.
  • PEP 644 (Require OpenSSL 1.1. or newer) : OpenSSL 의 1.1.1 이상 버전을 지원
  • PEP 624 (Remove Py_UNICODE encoder APIs)
  • PEP 597 (Add optional EncodingWarning)

태그:

카테고리:

업데이트: