[Python-Dev] LOAD_SELF and SELF_ATTR opcodes
Tim Delaney
tcdelaney at optusnet.com.au
Sat Oct 15 02:30:07 CEST 2005
Sorry I can't reply to the message (I'm at home, and don't currently have
python-dev sent there).
I have a version of Raymond's constant binding recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940
that also binds all attribute accesses all the way down into a single
constant call e.g.
LOAD_FAST 0
LOAD_ATTR 'a'
LOAD_ATTR 'b'
LOAD_ATTR 'c'
LOAD_ATTR 'd'
is bound to a single constant:
LOAD_CONST 5
where constant 5 is the object obtained from `self.a.b.c.d`. Unfortunately,
I think it's at work - don't seem to have a copy here :(
Obviously, this isn't applicable to as many cases, but it might be
interesting to compare what kind of results this produces compared to
LOAD_SELF/SELF_ATTR.
Tim Delaney
More information about the Python-Dev
mailing list