Steve Holden added the comment:
Is a fix really required? Are we really supposed to protect programmers from
their own folly by second-guessing when constant folding might be required and
when it might not? How is hte interpreter supposed to know the function isn't
called?
The simple solution to this problem is available in Python: simply declare a
manifest constant and use that instead:
UNCALLED_SIZE = 2**32
def uncalled():
x = b'x' * UNCALLED_SIZE
I'd recommend closing this issue (though I'm glad that people are concerned
with optimization, I don't think that an optimizer should be too concerned with
those rare cases when their optimization doesn't optimize.
But I'm not going to close it: wiser heads than mine are required.
----------
nosy: +holdenweb
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21074>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com