OpenAI Notes

IndexComment prompt

Comment prompt

A comment prompt is a coding request that includes comments: notes about what not to change, which Python you run, or which line is the bug. The model reads those lines. Python itself ignores them.

Updated 2026-09-27

The thread behind the query is How can I write comments in a prompt when coding in Python?. Use `#` for a line comment and triple quotes only when you mean a docstring. Both are visible to ChatGPT if they are in the paste.

Comments that help

  • `# do not add dependencies` so the patch stays in the standard library
  • `# bug: returns None when items is empty` on the function you want fixed
  • `# Python 3.12` so it does not invent syntax you cannot run
  • Do not put keys, customer rows, or passwords in a comment and then paste the file

If the goal is learning the language rather than annotating one prompt, start with Python programming with AI. If the goal is a side-by-side edit, open Canvas.

Questions

Will the model ignore my # comments?

No. The Python interpreter ignores them. The model uses them as instructions when they are part of the prompt.

Should I ask it to add comments to the code?

Ask for comments on the branches a reader would miss. A comment on every line makes the next diff harder to read.

  • Python programming with AI

    Use ChatGPT to learn Python by pasting the error and the few lines around it. Run the result locally. Do not paste secrets into the prompt.

  • ChatGPT Canvas

    ChatGPT Canvas is the side panel for editing a document or a code file while the chat stays open. It is part of ChatGPT, not a separate subscription.

  • Codex status and usage

    Check Codex uptime on status.openai.com, plan limits at chatgpt.com/codex/settings/usage, and the CLI with /status. API spend is a different page.

Sources