Paul Prescod wrote: > >>> def foo(a): > ... b = a + 5 > ... return b > > Why does the RETURN_VALUE opcode have to return something from the > stack? Why not have a RETURN_VAR opcode that would directly return a > variable or constant? (a leading bit could indicate whether to look in > the const or var tuple). I notice that your example could be rewritten to return directly from the stack. Perhaps the 'code' module could grow an .optimize function or submodule...? > And as long as we are talking about referring to things more directly, > wouldn't it be possible to refer to constants by pointer rather than > indirecting through the index? You'd have to fix up pointers when you > first loaded the code but only once per function. Then all our fancy bytecode hacks would have to redirect the pointers back into the index again. ;) Robert Brewer MIS Amor Ministries fumanchu at amor.org
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