[Python-ideas] Object grabbing
rosuav at gmail.com
Sun May 1 20:03:31 EDT 2016
On Mon, May 2, 2016 at 9:56 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> The only new thing in your proposal is the change to the
> bytecode, and that could be achieved by treating it as
> an optimisation. A sufficiently smart code generator
> could notice that you were repeatedly operating on the same
> object and produce the bytecode you suggest.
"self" was mentioned. I wonder whether there could be some additional
optimization magic applied to a function's first argument, same as the
no-arg super() call? Since it's a semantic-free optimization, any
Python implementation would be free to mess with this. Have opcodes
for "LOAD_ARG1_ATTR" and "STORE_ARG1_ATTR", semantically equivalent to
LOAD_FAST 0 followed by LOAD_ATTR or STORE_ATTR.
More information about the Python-ideas