Collin Winter <coll...@gmail.com> added the comment: On Fri, May 29, 2009 at 3:45 PM, Martin v. Löwis <rep...@bugs.python.org> wrote: > py> s = "" > py> s.join is s.join > False > > Every time you read it, you get a new object. Not what I would call a > constant. If you don't see how this matters, try > > def foo(): > return "".join > > print foo() is foo() > > with and without your patch.
The fact that it returns a new object every time seems like an implementation detail, and one that users find confusing (I know I once filed a bug about it). One problem I recognize is that the proposed patch would presumably create an asymmetry between "x".join is "x".join and "x = 'x'; x.join is x.join" where the former would evaluate to True and the latter to False. That seems surmountable, though. ---------- title: LOAD_CONST followed by LOAD_ATTR can be optimized to just be a LOAD_COST -> LOAD_CONST followed by LOAD_ATTR can be optimized to just be a LOAD_COST _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6133> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com