On 3/20/2015 3:59 AM, Paulo Pinto wrote:
On Friday, 20 March 2015 at 10:50:44 UTC, Walter Bright wrote:
Since 'line' is never referred to again after constructed, even a simple
optimizer could elide it.
It would be easy to test - accumulate the lines in an array, and check the
times.
Which the default Python implementation doesn't have, hence my comment.
After all these years, the default Python implementation doesn't do fairly basic
optimizations? I find that a bit hard to believe.
Also even if it did have one, it cannot elide it as it cannot guarantee the
semantics of the generators/iterators side effects will be kept.
I wonder why keeping a string would be a side effect.
I'm not saying you're wrong, I don't know Python well enough to make such a
judgement. It just causes me to raise one eyebrow like Spock if it does work
this way.