PEP 5: 言語開発ã®ã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ ======================================== 原文: http://www.python.org/dev/peps/pep-0005/ +---------------+----------------------------------------------+ | PEP | 5 | +---------------+----------------------------------------------+ | Title | Guidelines for Language Evolution | +---------------+----------------------------------------------+ | Version | 56036 | +---------------+----------------------------------------------+ | Last-Modified | 2007-06-19 06:52:34 +0200 (Tue, 19 Jun 2007) | +---------------+----------------------------------------------+ | Author | paul@prescod.net (Paul Prescod) | +---------------+----------------------------------------------+ | Status | Active | +---------------+----------------------------------------------+ | Type | Process | +---------------+----------------------------------------------+ | Created | 26-Oct-2000 | +---------------+----------------------------------------------+ | Post-History | | +---------------+----------------------------------------------+ .. Abstract ---------- æ¦‚è¦ ---------- .. In the natural evolution of programming languages it is sometimes necessary to make changes that modify the behavior of older programs. This PEP proposes a policy for implementing these changes in a manner respectful of the installed base of Python users. プãƒã‚°ãƒ©ãƒŸãƒ³ã‚°è¨€èªžã®è‡ªç„¶ãªç™ºå±•形態ã«ãŠã„ã¦ã€éŽåŽ»ã®ãƒ—ãƒã‚°ãƒ©ãƒ ã®æŒ¯ã‚‹èˆžã„ã‚’ 変ãˆã‚‹å¿…è¦ãŒã‚ã‚‹å ´åˆãŒæ™‚ã¨ã—ã¦èµ·ã“りã¾ã™ã€‚ã“ã®PEPã§ã¯ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’主体㨠ã™ã‚‹Pythonユーザã«ã¨ã£ã¦ä¸å¯§ã«å¤‰åŒ–ãŒèµ·ãるよã†ã«ã€å®Ÿè£…ã®ãƒãƒªã‚·ãƒ¼ã‚’ææ¡ˆã— ã¾ã™ã€‚ .. Implementation Details ---------------------- 実装ã®è©³ç´° --------------- .. Implementation of this PEP requires the addition of a formal warning and deprecation facility that will be described in another proposal. ã“ã®PEPã®å®Ÿè£…ã«ã¯ã€è¿½åŠ ã®æ£å¼ãªè¦å‘Šã¨ä»–ã®ææ¡ˆã®ä¸ã§è¨€åŠã•れるã§ã‚ã‚ã†åˆ©ä¾¿ 性ã¨ã‚’è¿½åŠ ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 .. Scope ------ 範囲 ----- .. These guidelines apply to future versions of Python that introduce backward-incompatible behavior. Backward incompatible behavior is a major deviation in Python interpretation from an earlier behavior described in the standard Python documentation. Removal of a feature also constitutes a change of behavior. ã“れらã®ã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã¯Pythonã®å°†æ¥ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«å¯¾ã—ã¦å¾Œæ–¹äº’æ›æ€§ã®æŒ¯ã‚‹èˆž ã„を紹介ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§ã™ã€‚å¾Œæ–¹äº’æ›æ€§ã‚’ãªãã™ã“ã¨ã¯ã€æ¨™æº–ã®Pythonドã‚ュ メントãŒã‹ã‹ã‚ŒãŸåˆæœŸæ®µéšŽã‹ã‚‰ãªã•れã¦ã„る説明を逸脱ã™ã‚‹ã“ã¨ã§ã™ã€‚æ©Ÿèƒ½ã‚’å– ã‚Šé™¤ãã“ã¨ã‚‚ã€åŒæ§˜ã«æŒ¯ã‚‹èˆžã„を変更ã™ã‚‹ã“ã¨ã¨ãªã‚Šã¾ã™ã€‚ .. This PEP does not replace or preclude other compatibility strategies such as dynamic loading of backwards-compatible parsers. On the other hand, if execution of "old code" requires a special switch or pragma then that is indeed a change of behavior from the point of view of the user and that change should be implemented according to these guidelines. ã“ã®PEPã¯å¾Œæ–¹äº’æ›æ€§ãŒã‚るパーサーã®Dynamic Loadingãªã©ã¨ã„ã£ãŸã€ä»–ã®äº’æ› æ€§ã‚’æä¾›ã™ã‚‹æŠ€è¡“ã‚’ç½®ãæ›ãˆãŸã‚Šã€å‰è§¦ã‚Œã¨ã™ã‚‹ã‚‚ã®ã§ã¯ã‚りã¾ã›ã‚“。一方ã€"å¤ ã„コード"ã®å®Ÿè¡ŒãŒç‰¹åˆ¥ãªåˆ‡ã‚Šæ›¿ãˆã‚„pragmaã‚’è¦æ±‚ã™ã‚‹å ´åˆ(訳注: 自信無)ã€å®Ÿè¡Œ ã—ãŸã„ユーザã®è¦³ç‚¹ã‹ã‚‰ã€æŒ¯ã‚‹èˆžã„を変更ã™ã‚‹ã“ã¨ãŒå¿…è¦ã«ãªã‚‹ã“ã¨ã‚‚考ãˆã‚‰ã‚Œ ã¾ã™ã€‚ãã®å ´åˆã€ãã®å¤‰æ›´ã¯ã€ä»¥ä¸‹ã®ã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã«å¾“ã£ã¦å®Ÿè£…ã™ã‚‹å¿…è¦ãŒã‚り ã¾ã™ã€‚ .. In general, common sense must prevail in the implementation of these guidelines. For instance changing "sys.copyright" does not constitute a backwards-incompatible change of behavior! 一般ã«ã€ã“れらã®ã‚¬ã‚¤ãƒ‰ãƒ©ã‚¤ãƒ³ã®å®Ÿè£…ã«ãŠã„ã¦ã€å¸¸è˜ãŒå„ªå…ˆã•れã¾ã™ã€‚例ãˆã° "sys.copyright"ã®å¤‰æ›´ã¯ã€æŒ¯ã‚‹èˆžã„を変更ã—ã€å¾Œæ–¹äº’æ›æ€§ã®ä¸å‚™ã‚’引ãèµ·ã“ã—ã¾ ã™ã€‚(訳注: ã ã‘ã©å¸¸è˜ã§åˆ¤æ–ã—ã¦åˆ¥ã«å•題ãªã„ã€ã¨ã„ã„ãŸã„ã‚“ã ã¨æ€ã†) .. Steps For Introducing Backwards-Incompatible Features --------------------------------------------------------------- å¾Œæ–¹äº’æ›æ€§ã®æ©Ÿèƒ½ã‚’å°Žå…¥ã™ã‚‹ã‚¹ãƒ†ãƒƒãƒ— ------------------------------------ .. 1. Propose backwards-incompatible behavior in a PEP. The PEP must include a section on backwards compatibility that describes in detail a plan to complete the remainder of these steps. 1. PEPã§å¾Œæ–¹äº’æ›æ€§ã®æŒ¯ã‚‹èˆžã„ã‚’ææ¡ˆã—ã¾ã™ã€‚ãã®PEPã¯ä»¥ä¸‹ã®ã‚¹ãƒ†ãƒƒãƒ—を全部クリ ã‚¢ã™ã‚‹è©³ç´°ã«ã¤ã„ã¦è¿°ã¹ãŸå¾Œæ–¹äº’æ›æ€§ã«é–¢ã™ã‚‹ç¯€ã‚’å«ã¾ãªã‘れã°ã„ã‘ã¾ã›ã‚“。 .. 2. Once the PEP is accepted as a productive direction, implement an alternate way to accomplish the task previously provided by the feature that is being removed or changed. For instance if the addition operator were scheduled for removal, a new version of Python could implement an "add()" built-in function. 2. 一度PEPãŒé–‹ç™ºé …ç›®ã¨ã—ã¦å—ç†ã•れãŸã‚‰ã€å–り除ã‹ã‚ŒãŸã‚Šå¤‰æ›´ã•れãŸã‚Šã™ã‚‹ã“ã¨ã« ãªã‚‹ä»¥å‰ã®æ©Ÿèƒ½ã‚’åˆ¥ã®æ–¹æ³•ã§å®Ÿè£…ã—ã¾ã™ã€‚例ãˆã°ã€åŠ ç®—æ¼”ç®—åãŒå–り除ã‹ã‚Œã‚‹äº‹ ãŒæ±ºã¾ã£ãŸã‚‰ã€æ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®pythonã§ã¯ã€çµ„ã¿è¾¼ã¿ã®æ©Ÿèƒ½ã¨ã—ã¦"add()" を実装ã™ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“。 .. 3. Formally deprecate the obsolete construct in the Python documentation. 3. Pythonã®æ–‡æ›¸ã«ã¦ã€å¤ã„è¨è¨ˆã‚’æ£å¼ã«å»ƒæ¢ã«ã—ã¾ã™ã€‚ .. 4. Add an an optional warning mode to the parser that will inform users when the deprecated construct is used. In other words, all programs that will behave differently in the future must trigger warnings in this mode. Compile-time warnings are preferable to runtime warnings. The warning messages should steer people from the deprecated construct to the alternative construct. 4. parserã«ãƒ¦ãƒ¼ã‚¶ã«å¯¾ã—ã¦å»ƒæ¢ã•れãŸã¨ã„ã†ã“ã¨ã‚’知らã›ã‚‹ã‚ªãƒ—ショナルãªè¦å‘Šãƒ¢ãƒ¼ ãƒ‰ã‚’è¿½åŠ ã—ã¾ã™ã€‚ã¤ã¾ã‚Šã€ç•°ãªã‚‹æŒ¯ã‚‹èˆžã„ã‚’ã™ã‚‹å…¨ã¦ã®ãƒ—ãƒã‚°ãƒ©ãƒ ã¯å°†æ¥ã«æ¸¡ã£ ã¦ã“ã®è¦å‘Šãƒ¢ãƒ¼ãƒ‰ã§è¦å‘Šã‚’表示ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 コンパイル時ã®è¦å‘Šã¯å®Ÿ 行時ã®è¦å‘Šã‚ˆã‚Šæœ›ã¾ã—ã„ã§ã™ã€‚ã“ã®è¦å‘Šãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯å»ƒæ¢ã•ã‚ŒãŸæ‰‹æ³•ã‹ã‚‰åˆ¥ã®æ‰‹ 法ã¸ã¨å¤‰æ›´ã™ã‚‹ã‚ˆã†ã«ãƒ¦ãƒ¼ã‚¶ã«åŠ©è¨€ã™ã‚‹ã‚‚ã®ã§ã‚ã‚‹ã¹ãã§ã™ã€‚ .. 5. There must be at least a one-year transition period between the release of the transitional version of Python and the release of the backwards incompatible version. Users will have at least a year to test their programs and migrate them from use of the deprecated construct to the alternative one. 移行ã—ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒªãƒªãƒ¼ã‚¹ã¨å¾Œæ–¹äº’æ›æ€§ãŒãªããªã£ãŸãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒªãƒªãƒ¼ スã¨ã®é–“éš”ã¯ã€æœ€ä½Ž1å¹´ã®æœŸé–“ã‚’ç½®ãã¹ãã§ã™ã€‚ãƒ¦ãƒ¼ã‚¶ã¯æœ€ä½Ž1å¹´é–“ã®è‡ªåˆ†ã®ãƒ— ãƒã‚°ãƒ©ãƒ をテストã§ãã€å»ƒæ¢ã•ã‚ŒãŸæ‰‹æ³•ã‹ã‚‰åˆ¥ã®æ‰‹æ³•ã¸ã¨å¤‰æ›´ã§ãã¾ã™ã€‚ Local Variables: coding: utf-8 End: