Andrew Dalke added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21074>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to