Self reject PEP 329.

This commit is contained in:
Raymond Hettinger 2004-04-20 17:51:11 +00:00
parent 6c168af9b0
commit d8f2eaf03c
2 changed files with 15 additions and 8 deletions

View File

@ -123,7 +123,6 @@ Index by Category
S 324 popen5 - New POSIX process module Astrand S 324 popen5 - New POSIX process module Astrand
S 325 Resource-Release Support for Generators Pedroni S 325 Resource-Release Support for Generators Pedroni
S 327 Decimal Data Type Batista S 327 Decimal Data Type Batista
S 329 Treating Builtins as Constants in the Standard Library Hettinger
S 754 IEEE 754 Floating Point Special Values Warnes S 754 IEEE 754 Floating Point Special Values Warnes
Finished PEPs (done, implemented in CVS) Finished PEPs (done, implemented in CVS)
@ -195,6 +194,7 @@ Index by Category
SD 316 Programming by Contract for Python Way SD 316 Programming by Contract for Python Way
SR 317 Eliminate Implicit Exception Instantiation Taschuk SR 317 Eliminate Implicit Exception Instantiation Taschuk
SR 326 A Case for Top and Bottom Values Carlson, Reedy SR 326 A Case for Top and Bottom Values Carlson, Reedy
SR 329 Treating Builtins as Constants in the Standard Library Hettinger
SR 666 Reject Foolish Indentation Creighton SR 666 Reject Foolish Indentation Creighton
@ -350,7 +350,7 @@ Numerical Index
SR 326 A Case for Top and Bottom Values Carlson, Reedy SR 326 A Case for Top and Bottom Values Carlson, Reedy
S 327 Decimal Data Type Batista S 327 Decimal Data Type Batista
SA 328 Imports: Multi-Line and Absolute/Relative Aahz SA 328 Imports: Multi-Line and Absolute/Relative Aahz
S 329 Treating Builtins as Constants in the Standard Library Hettinger SR 329 Treating Builtins as Constants in the Standard Library Hettinger
SR 666 Reject Foolish Indentation Creighton SR 666 Reject Foolish Indentation Creighton
S 754 IEEE 754 Floating Point Special Values Warnes S 754 IEEE 754 Floating Point Special Values Warnes

View File

@ -3,7 +3,7 @@ Title: Treating Builtins as Constants in the Standard Library
Version: $Revision$ Version: $Revision$
Last-Modified: $Date$ Last-Modified: $Date$
Author: Raymond Hettinger <python at rcn.com> Author: Raymond Hettinger <python at rcn.com>
Status: Draft Status: Rejected
Type: Standards Track Type: Standards Track
Content-Type: text/x-rst Content-Type: text/x-rst
Created: 18-Apr-2004 Created: 18-Apr-2004
@ -11,6 +11,13 @@ Python-Version: 2.4
Post-History: 18-Apr-2004 Post-History: 18-Apr-2004
Status
======
The PEP is self rejected by the author due to the unprecedented
level of enmity it generated from developers.
Abstract Abstract
======== ========
@ -52,7 +59,7 @@ and performance will improve across the board.
Proposal Proposal
======== ========
Add a module called pragma.py which contains two functions, Add a module called codetweaks.py which contains two functions,
`bind_constants()` and `bind_all()`. The first function performs `bind_constants()` and `bind_all()`. The first function performs
constant binding and the second recursively applies it to every constant binding and the second recursively applies it to every
function and class in a target module. function and class in a target module.
@ -60,8 +67,8 @@ function and class in a target module.
For most modules in the standard library, add a pair of lines near For most modules in the standard library, add a pair of lines near
the end of the script:: the end of the script::
import pragma, sys import codetweaks, sys
pragma.bind_all(sys.modules[__name__]) codetweaks.bind_all(sys.modules[__name__])
In addition to binding builtins, there are some modules (like In addition to binding builtins, there are some modules (like
`sre_compile`) where it also makes sense to bind module variables `sre_compile`) where it also makes sense to bind module variables
@ -114,7 +121,7 @@ Questions and Answers
implementations? implementations?
Either do this before importing a module, or just reload the Either do this before importing a module, or just reload the
module, or disable `pragma.py` (it will have a disable flag). module, or disable `codetweaks.py` (it will have a disable flag).
8. How susceptible is this module to changes in Python's byte coding? 8. How susceptible is this module to changes in Python's byte coding?
@ -135,7 +142,7 @@ Questions and Answers
Sample Implementation Sample Implementation
===================== =====================
Here is a sample implementation for pragma.py:: Here is a sample implementation for codetweaks.py::
from types import ClassType, FunctionType from types import ClassType, FunctionType
from opcode import opmap, HAVE_ARGUMENT, EXTENDED_ARG from opcode import opmap, HAVE_ARGUMENT, EXTENDED_ARG