[Jack Diederich] > The behavior of a program under -O should be as similar as possible to normal > operation. This would break that for some programs. > A per-file pragma directive would work. [Skip Montanero] > This is clearly a semantic change, so > I'd like to see a different command line flag control this behavior [M.-A. Lemburg] > Using the -O for this is not a working possibility. -OO > is reserved for optimizations which can change semantics, > but even there, I'd rather like a per-module switch than > a command line switch. That makes good sense. Are you guys thinking of something like this: __fastbuiltins__ = True # optimize all subsequent defs in the module [Jack Diederich] > The downside of a pragma module or > keyword would be what people try to add to it later. Ideally, enabling the pragma would also trigger warnings when the module shadows a builtin. [M.-A. Lemburg] > BTW, why not have a new opcode for symbols in the > builtins and then only tweak the opcode implementation > instead of having the compiler generate different code ? Either way results in changing one opcode/oparg pair, so I don't see how having a new opcode helps. At some point, the name has to be looked-up and a reference to it stored. Afterwards, LOAD_CONST is all that is needed to fetch the reference. Raymond Hettinger
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4