# Cryptic sequences in comments

**URL:** <https://discuss.python.org/t/cryptic-sequences-in-comments/38694>\
**Category:** Core Development\
**Created:** [November 14, 2023, 11:33am UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694 "2023-11-14T11:33:15Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![tjreedy](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/tjreedy/32/137_2.png) [@tjreedy](https://discuss.python.org/u/tjreedy)\
**Post date:** [November 14, 2023, 6:46pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/21 "2023-11-14T18:46:41Z")

</div>

Idlelib has 36 uppercase whole-word 'XXX’s and 34 'TODO’s (not counting colorizer ‘TODO’ tags). Most of the ‘XXX’ tags are inplied (soft?) 'TODO’s, with ‘should’, ‘could’, ‘would’, ‘ought’, ‘check’, ‘decide’, or even ‘TO DO’. Some are mine, most not I think.

---

<div class="post-metadata">

**Author:** ![pitrou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pitrou/32/28_2.png) [@pitrou](https://discuss.python.org/u/pitrou)\
**Post date:** [November 14, 2023, 7:40pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/22 "2023-11-14T19:40:40Z")

</div>

According to [GitHub code search](https://github.com/search?q=XXX+language%3AC&type=code&l=C&p=1), the string “XXX” appears in more than 2 million C files. According to the first result pages, this seems to be mostly in comments to flag questions, warts and gotchas.

The Python codebase is not really an outlier in this regard.

---

<div class="post-metadata">

**Author:** ![nas](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nas/32/536_2.png) [@nas](https://discuss.python.org/u/nas)\
**Post date:** [November 14, 2023, 7:45pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/23 "2023-11-14T19:45:57Z")

</div>

I would recommend _not_ going through the code and removing XXX. That’s like a hit-and-run code cleanup change that we discourage. We should recommend it not be used in future code, since obviously some people are confused by it. To me, it means something like `NOTE`. The main advantages is probably that it’s easy to type, easy to search for and also stands out.

---

<div class="post-metadata">

**Author:** ![malemburg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/malemburg/32/50_2.png) [@malemburg](https://discuss.python.org/u/malemburg)\
**Post date:** [November 14, 2023, 8:24pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/24 "2023-11-14T20:24:50Z")

</div>

I looked around a bit more and found that XXX is a way of calling out for _attention_: it’s the [morse code version of Pan-Pan](https://en.wikipedia.org/wiki/Pan-pan). In other contexts it is used as a _wildcard_, e.g. when referring to sets of symbols as in `.fetchxxx()`.

---

<div class="post-metadata">

**Author:** ![gpshead](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/gpshead/32/54_2.png) [@gpshead](https://discuss.python.org/u/gpshead)\
**Post date:** [November 15, 2023, 12:21am UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/25 "2023-11-15T00:21:36Z")

</div>

If you don’t want to see more `XXX` comments checked in with code: add a check to our make patchcheck CI step that blocks merging when newly added/changed lines contain one. The error message should recommend people use TODO, referencing a filed Issue# when deemed appropriate. Nobody is likely to meaningfully object to such a check. With that in place, the number will slowly trend downwards over time. 🙂

Some noteworthy widely used style guides go further and effectively require the issue be referenced in the comment such as [Google’s Python](https://google.github.io/styleguide/pyguide.html#312-todo-comments) & [C++ guides](https://google.github.io/styleguide/cppguide.html#TODO_Comments) - I don’t think we have a reason to go _that_ far in CPython _(but I wouldn’t object if consensus says “do it”)_.

Regardless, I recommend not worrying about existing `XXX`s in the codebase. At a glance via grep there appears to be ~1500 of them in CPython `main`.

* * *

_Yet another explanation the history of XXX elided given:_ Questioning XXX is not a _new_ question or conversation. It has happened multiple times before in other forums for other projects per some quick Google searches. [What is the meaning of #XXX in code comments? - Stack Overflow](https://stackoverflow.com/questions/1452934/what-is-the-meaning-of-xxx-in-code-comments) being a typical canonical reference. Lending support to the idea of just not using XXX in new code.

---

<div class="post-metadata">

**Author:** ![erlendaasland](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/erlendaasland/32/4378_2.png) [@erlendaasland](https://discuss.python.org/u/erlendaasland)\
**Post date:** [November 15, 2023, 8:07pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/26 "2023-11-15T20:07:52Z")

</div>

Yeah, a CI check sounds good to me. The discussion history clearly shows that the meaning of XXX belongs to the code writer, not the reader; it does not add value to a comment.

> [@nas](#):
>
> I would recommend _not_ going through the code and removing XXX

Of course not; that goes for all style suggestions, both PEP-7 and PEP-8.

---

<div class="post-metadata">

**Author:** ![kenahoo](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/kenahoo/32/5714_2.png) [@kenahoo](https://discuss.python.org/u/kenahoo)\
**Post date:** [November 18, 2023, 4:56pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/27 "2023-11-18T16:56:42Z")

</div>

> [@malemburg](#):
>
> To me, the XXX code tag simply means: _attention_, nothing more, nothing less.

In that case, I think using `ATTENTION` would be much more clear.

I certainly wouldn’t interpret `XXX` as meaning anything in particular, unless it were “this comment contains pornography” or “this comment contains an old-timey jug of prohibition-era bootleg alcohol”.

---

<div class="post-metadata">

**Author:** ![Rosuav](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rosuav/32/3429_2.png) [@Rosuav](https://discuss.python.org/u/Rosuav)\
**Post date:** [November 18, 2023, 6:03pm UTC](https://discuss.python.org/t/cryptic-sequences-in-comments/38694/28 "2023-11-18T18:03:25Z")

</div>

> [@kenahoo](#):
>
> I certainly wouldn’t interpret `XXX` as meaning anything in particular, unless it were “this comment contains pornography” or “this comment contains an old-timey jug of prohibition-era bootleg alcohol”.

Look, I know there’s weird and bad code out there, but if ever an IDE or programming language allows you to donate moonshine to the subsequent maintainers, it will be an instant success…

Personally, I’ve never used the XXX convention, largely because of these ambiguities. I’d rather write FIXME, TODO, or NOTE, or sometimes HACK (which overlaps with some of the use of XXX here, I think? it’s acknowledging that something is hacky and disgusting, but working).

[Previous page](https://discuss.python.org/t/cryptic-sequences-in-comments/38694.md?page=1)
