[issue6133] LOAD_CONST followed by LOAD_ATTR can be optimized to just be a LOAD_COST

Raymond Hettinger report at bugs.python.org
Sat May 30 05:09:48 CEST 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Returning the same object vs new object for bound methods is a
non-guaranteed implementation detail (as long the other semantics remain
true).   I think Martin's real concern is that trying to intern bound
methods would be a can of worms (one that I wouldn't want to open).

FWIW, str.join ignored by this patch.  The "str" builtin is an
overridable builtin (LOAD_GLOBAL "str" LOAD_ATTR "join").  In contrast,
",".join or "{}".format does not have dynamically changeable behavior
(LOAD_CONST "{}" LOAD_ATTR "format").

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6133>
_______________________________________


More information about the Python-bugs-list mailing list