This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dalke
Recipients alex, benjamin.peterson, dalke, eryksun, holdenweb, methane, ncoghlan, pitrou, rhettinger, vstinner
Date 2017-05-22.21:13:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1495487590.36.0.157298568788.issue21074@psf.upfronthosting.co.za>
In-reply-to
Content
I do not think quoting the Zen of Python helps anything. As I wrote, "it gives different answers depending on where one draws the line." This includes "practicality beats purity".

From my viewpoint, the peephole optimizer isn't going to change because the core developers prioritize the purity of not adding special cases over the practicality of supporting reasonable real-world code. Or the purity of the long-awaited AST optimizer over the practicality of changing the existing, fragile peephole optimizer.

I also appreciate the viewpoint that the practicality of a maintainable peephole optimizer beats the impossible purity of trying to support all use cases gracefully. My line, of course, only wants it to handle my use case, which is the issue reported here.

My goal from this is not to re-open the topic. It is to provide a counter-balance to opinions expressed here that place all blame onto the programmer whose 'folly' lead to 'arcane' and 'insane' code. (The 'insane' is used at http://bugs.python.org/issue30293#msg293172 as "Burdening the optimizer with insanity checks just slows down the compilation of normal, sane code.")

The use case pulled from my project, which is very near to the original report by INADA Naoki, seems entirely sane and not at all arcane. How else might one test 64-bit addressing than by constructing values which are over 4GB in length? Indeed, Python itself has similar test code. Quoting Lib/test/test_zlib.py:


# Issue #10276 - check that inputs >=4GB are handled correctly.
class ChecksumBigBufferTestCase(unittest.TestCase):

    @bigmemtest(size=_4G + 4, memuse=1, dry_run=False)
    def test_big_buffer(self, size):
        data = b"nyan" * (_1G + 1)
        self.assertEqual(zlib.crc32(data), 1044521549)
        self.assertEqual(zlib.adler32(data), 2256789997)


Is the difference between happiness and "folly" really the difference between writing "_1G" and "2**30"? If so, how are people supposed to learn the true path? Is that not exactly the definition of 'arcane'?

The Code of Conduct which governs comments here requests that we be considerate and respective. Terms like 'folly' and 'arcane', at least for what I think is an entirely reasonable use case, seems to run counter to that spirit.
History
Date User Action Args
2017-05-22 21:13:10dalkesetrecipients: + dalke, rhettinger, holdenweb, ncoghlan, pitrou, vstinner, benjamin.peterson, alex, methane, eryksun
2017-05-22 21:13:10dalkesetmessageid: <1495487590.36.0.157298568788.issue21074@psf.upfronthosting.co.za>
2017-05-22 21:13:10dalkelinkissue21074 messages
2017-05-22 21:13:09dalkecreate