I think that pull request #1682 should be reverted. It seems to be common practice across programming languages to use `# ` (hash-space, or the language's corresponding comment mark) for "real" comments (English sentences describing what's going on in a script or file) and `#` (hash with no space) for commenting out code (temporarily disabling a line of code, mostly for debugging purposes). This practice is commonly seen in config files: ```ini # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console ``` but I have seen it used in Python as well. Specifically, [the CPython repository](https://github.com/python/cpython) seems to prefer `#` (without space) to `# ` for commented-out code (which is rare, but still present in the repo), while using `# ` (with space) for actual comments with readable sentences, as recommended by [PEP 8](https://peps.python.org/pep-0008/#block-comments). Example (as seen in [setup.py from the Cpython repository as of v3.6.3](https://github.com/python/cpython/blob/v3.6.3/setup.py#L2168-L2169)): ```py # Uncomment for extra functionality: #define_macros.append(('EXTRA_FUNCTIONALITY', 1)) ```
The aforementioned repo seems to actually mix both styles of comment (which isn't surprising for something with multiple authors), but I think the style of commented-out code using no space helps distinguish it from textual comments. As an example, notice how these code snippets are ambiguous (it's hard to tell whether the last line is part of the comment, or a commented-out line of code, at least at a first glance): ```py # B.2 is case folding for NFKC. This is the same as B.3, # except where NormalizeWithKC(Fold(a)) != # NormalizeWithKC(Fold(NormalizeWithKC(Fold(a)))) ``` ```py # Workaround CPython bug #23353: using yield/yield-from in an # except block of a generator doesn't clear properly # sys.exc_info() err = exc ``` ```py # Above depended on config-extensions.def having Alt keys, # which is no longer true. # sys.platform = 'darwin' # self.assertNotEqual(conf.GetCurrentKeySet(), conf.GetKeySet(conf.CurrentKeys())) ``` ```py # this may not work if the forward lookup choses the IPv6 address, as that doesn't # have a reverse entry yet # socket.gethostbyaddr('испытание.python.org') ``` ```py # Uncomment the next line for debugging. # sys.stderr.write(format % args) pass ``` whereas these are quite unambiguous: ```py # The following no longer raises a TypeError - it is now # possible, as in C, to call cdecl functions with more parameters. #self.assertRaises(TypeError, c, 1, 2, 3) self.assertEqual(c(1, 2, 3, 4, 5, 6), 3) ``` ```py # RFC 1808 and RFC 1630 disagree on these (according to RFC 1808), # so we'll not actually run these tests (which expect 1808 behavior). #self.checkJoin(RFC1808_BASE, 'http:g', 'http:g') #self.checkJoin(RFC1808_BASE, 'http:', 'http:') ``` Bottom line: #1682 was introduced to make commented-out code agree with [PEP 8](https://peps.python.org/pep-0008/#block-comments), but PEP 8 does not apply to commented-out lines of code, which are not "proper comments" that explain what the code does. In fact, commented-out code should aim to NOT look like normal comments. Also, making the default comment string be `# ` makes the Ctrl-E comment toggle mark be `# ~ `, which looks quite weird, instead of `#~ `. The old behavior can be configured in the user config files, but I think it should be the default. -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/3462 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany/issues/3...@github.com>