Martin v. Löwis <mar...@v.loewis.de> added the comment:

Terry J. Reedy wrote:
> Terry J. Reedy <tjre...@udel.edu> added the comment:
> 
> Martin, I agree that we would have to think carefully about all
> attributes of all constants loaded by LOAD_CONST, and about
> special-casing marshal, but given that "'str' object attribute 'join' is
> read-only", how is ''.join not a constant?  

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.

----------
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

Reply via email to