[Python-Dev] PEP 329: Treating Builtins as Constants in the Standard Library (original) (raw)
Phillip J. Eby pje at telecommunity.com
Mon Apr 19 09:30:55 EDT 2004
- Previous message: [Python-Dev] PEP 329: Treating Builtins as Constants in the Standard Library
- Next message: [Python-Dev] PEP 329: Treating Builtins as Constants in the Standard Library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 08:54 AM 4/19/04 -0400, Raymond Hettinger wrote:
Comments are invited on a new pep:
I'm not sure I understand the reasoning for implementing this via a bytecode hack, rather than in the compiler or loading mechanisms. I think I'd rather see something like:
from __future__ import fast_globals
which would mean that globals and builtins could be considered constants unless declared with 'global' at the module level. Then, the compiler could optimize any undeclared builtins, and the 'MAKE_FUNCTION' opcode could bind any constants defined as of the function's declaration.
Finally, the module object thus created would ban any setattr on any constant that has been bound into a function. (Since these are the only setattrs that could cause harm.)
- Previous message: [Python-Dev] PEP 329: Treating Builtins as Constants in the Standard Library
- Next message: [Python-Dev] PEP 329: Treating Builtins as Constants in the Standard Library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]