PEP 3139 – sys 정리와 “interpreter”(인터프리터) 모듈
- Author:
- Benjamin Peterson <benjamin at python.org>
- Status:
- Rejected
- Type:
- Standards Track
- Created:
- 04-Apr-2008
- Python-Version:
- 3.0
Table of Contents
번역·라이선스 안내
이 비공식 한국어 번역은 원문 Copyright 절의 Public Domain 조건에 따라 제공합니다. 원저자와 공식 원문은 그대로 표시합니다. 수정되지 않은 기준 원문 · 공식 최신판
거부 공지
귀도(Guido)가 -0.5를 표하면서 이 PEP는 중단되었습니다. https://mail.python.org/pipermail/python-3000/2008-April/012977.html 을 참조하십시오.
초록
이 PEP는 sys 모듈을 정리하고 일반적인 파이썬 기능을 구현 세부 사항과 분리하기 위해, CPython 전용 인터프리터 함수를 담는 새로운 저수준 모듈을 제안합니다.
근거
현재 sys 모듈에는 크게 두 그룹으로 나눌 수 있는 함수와 데이터가 들어 있습니다.
- 모든 Python 구현에서 사용할 수 있으며 Python 가상 머신의 일반적인 실행을 다루는 데이터와 함수입니다.
- argv
- byteorder
- path, path_hooks, meta_path, path_importer_cache, modules(모듈)
- copyright, hexversion, version, version_info
- displayhook, __displayhook__
- excepthook, __excepthook__, exc_info, exc_clear
- exec_prefix와 prefix
- executable
- exit
- flags(플래그), py3kwarning, dont_write_bytecode, warn_options
- getfilesystemencoding
- get/setprofile
- get/settrace, call_tracing
- getwindowsversion
- maxint와 maxunicode
- platform(플랫폼)
- ps1과 ps2
- stdin, stderr, stdout, __stdin__, __stderr__, __stdout__
- tracebacklimit
- CPython 인터프리터에 영향을 주는 데이터와 함수입니다.
- get/setrecursionlimit
- get/setcheckinterval
- _getframe과 _current_frame
- getrefcount
- get/setdlopenflags
- settscdumps
- api_version
- winver
- dllhandle
- float_info
- _compact_freelists
- _clear_type_cache
- subversion
- builtin_module_names
- callstats
- intern
두 번째 항목 모음은 수년에 걸쳐 꾸준히 늘어나 sys를 어수선하게 만들었습니다. Guido조차 그 안의 일부 항목은 무엇인지 모르겠다고 말한 적이 있습니다 [1]!
이 항목들을 다른 모듈로 옮기면 어떤 함수를 구현해야 하고 어떤 함수는 구현하지 않아도 되는지를 다른 Python 구현에 분명하게 알릴 수 있습니다.
types 모듈의 내용을 표준 라이브러리 전반에 분산하자는 제안도 있었습니다 [2]. 인터프리터 모듈은 프레임이나 코드 객체 같은 내부 타입을 두기에 매우 적합한 장소가 될 것입니다.
명세
“interpreter”(인터프리터)라는 이름의 새 내장 모듈이 추가됩니다(Naming 참조).
위의 두 번째 항목 목록은 다음과 같이 표준 라이브러리 여러 곳으로 나뉩니다:
- 인터프리터 모듈
- get/setrecursionlimit
- get/setcheckinterval
- _getframe과 _current_frame
- get/setdlopenflags
- settscdumps
- api_version
- winver
- dllhandle
- float_info
- _clear_type_cache
- subversion
- builtin_module_names
- callstats
- intern
- gc 모듈:
- getrefcount
- _compact_freelists
전환 계획
3.x에서 구현되면 interpreter(인터프리터) 모듈은 2.6으로 백포트될 것입니다. 이 모듈이 대체하는 sys 함수에는 Py3k 경고가 추가될 것입니다.
미해결 문제
무엇을 옮겨야 합니까?
dont_write_bytecode
일부는 바이트코드를 기록하는 것이 구현 세부 사항이므로 옮겨야 한다고 생각합니다 [3]. 이에 대한 반론은 현재의 완전한 Python 구현이 모두 어떤 형태로든 바이트코드를 기록하므로, 이를 비활성화할 수 있는 것이 유용하다는 것입니다. 또한 이것을 옮긴다면 imp 모듈에 넣기를 원하는 사람들도 있습니다.
일부를 imp로 옮겨야 합니까?
dont_write_bytecode 또는 어쩌면 builtin_module_names가 imp 모듈에 잘 어울릴 수 있다는 의견이 있었습니다.
명명
저자는 새 모듈의 이름으로 “interpreter”(인터프리터)를 제안합니다. “pyvm”이라는 이름도 제안되었습니다 [4]. “cpython”이라는 이름은 호응이 좋았습니다 [5].
참고 문헌
Copyright
This document has been placed in the public domain.