[python-committers] Deny nonbreaking spaces in the precommit script?

Nick Coghlan ncoghlan at gmail.com
Mon Nov 8 13:53:36 CET 2010


On Mon, Nov 8, 2010 at 10:33 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> I personally don't care whether we deny non-breaking spaces or not. I
> see no reason to deny them, since the cause of the test_trace failure
> was ultimately a bug in the trace module, and the non-breaking space
> actually uncovered this bug (isn't uncovering bugs a good thing?). The
> interpreter has no problem with utf-8 characters in source files, and I
> guess most humans have no problems reading non-breaking spaces either.

Indeed, the problem with automating this particular test is that it is
ill-specified. Assuming we decided to change reindent.py (or added
some other checker) to reject unexpected characters:
- what characters are disallowed?
- are those characters also disallowed in string literals?
- what about source files that are specifically designed to test
handling of those characters in particular contexts?

Non-breaking spaces are legal in utf-8 encoded Python source files.
While including them accidentally is less than ideal, it is perfectly
valid to include them deliberately. Trying to design an automated
check that can make a reasonable guess at intent is going to require
far more effort than is needed.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the python-committers mailing list