Proposed PEP: Treating Builtins as Constants in the Standard Library
Carl Banks
imbosol at aerojockey.invalid
Sat Apr 17 22:01:57 EDT 2004
Raymond Hettinger wrote:
> PEP: 329
> Title: Treating Builtins as Constants in the Standard Library
> Author: Raymond Hettinger <python at rcn.com>
> Status: Pre-PEP
>
>
> Abstract
> ========
>
> This proposal is to add a private function for treating builtin
> references as constants and to apply that function throughout
> the standard library.
Two things:
1. The new _bind module needs to have a more specific (and
appropriate) name than _bind. The function in the module could
still be named bind, but the module itself should be named
something like
_optimize_globals_as_consts_very_unsafe
(Ok, but you get the idea.)
2. The module being optimized should have a special attribute, say
__variable__, that identifies any globals that should not be
optimized in this way:
__variable__ = ['global_that_might_change']
Other than that, +1. I'm definitely in favor of optimization hacks
whenever it doesn't intrude too much on the code. It would be nice if
it were safer.
--
CARL BANKS http://www.aerojockey.com/software
"If you believe in yourself, drink your school, stay on drugs, and
don't do milk, you can get work."
-- Parody of Mr. T from a Robert Smigel Cartoon
More information about the Python-list
mailing list