Skip to content

PEP NNN: block comments in Python - #5072

Closed
uzyfabbargama wants to merge 1 commit into
python:mainfrom
uzyfabbargama:patch-1
Closed

PEP NNN: block comments in Python#5072
uzyfabbargama wants to merge 1 commit into
python:mainfrom
uzyfabbargama:patch-1

Conversation

@uzyfabbargama

Copy link
Copy Markdown

This PEP proposes a new syntax for block comments in Python using #""" and ##""" delimiters. It aims to provide a consistent and efficient way to comment and uncomment code blocks, addressing the lack of native block comment syntax in Python.

Basic requirements (all PEP Types)

  • Read and followed PEP 1 & PEP 12
  • File created from the latest PEP template
  • PEP has next available number, & set in filename (pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) and PEP header
    • Tip: find the next available number with pepotron — run uvx pepotron next (or pipx install pepotron then pep next)
  • Title clearly, accurately and concisely describes the content in 79 characters or less
  • Core dev/PEP editor listed as Author or Sponsor, and formally confirmed their approval
  • Author, Status (Draft), Type and Created headers filled out correctly
  • PEP-Delegate, Topic, Requires and Replaces headers completed if appropriate
  • Required sections included
    • Abstract (first section)
    • Copyright (last section; exact wording from template required)
  • Code is well-formatted (PEP 7/PEP 8) and is in code blocks, with the right lexer names if non-Python
  • PEP builds with no warnings, pre-commit checks pass and content displays as intended in the rendered HTML
  • Authors/sponsor added to .github/CODEOWNERS for the PEP

Standards Track requirements

  • PEP topic discussed in a suitable venue with general agreement that a PEP is appropriate
  • Suggested sections included (unless not applicable)
    • Motivation
    • Specification
    • Rationale
    • Backwards Compatibility
    • Security Implications
    • How to Teach This
    • Reference Implementation
    • Rejected Ideas
    • Open Issues
    • Acknowledgements
    • Footnotes
    • Change History
  • Python-Version set to valid (pre-beta) future Python version, if relevant
  • Any project stated in the PEP as supporting/endorsing/benefiting from the PEP formally confirmed such
  • Right before or after initial merging, PEP discussion thread created and linked to in Discussions-To and Post-History

This PEP proposes a new syntax for block comments in Python using `#"""` and `##"""` delimiters. It aims to provide a consistent and efficient way to comment and uncomment code blocks, addressing the lack of native block comment syntax in Python.
@uzyfabbargama
uzyfabbargama requested a review from a team as a code owner August 4, 2026 02:59
@python-cla-bot

python-cla-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pep-previews | 🛠️ Build #33899910 | 📁 Comparing 14a63de against latest (69a447a)

  🔍 Preview build  

8 files changed · + 1 added · ± 7 modified

+ Added

± Modified

Comment thread peps/pep-1234.rst
PEP: 1234
Title: Block Comments for #-Based Languages While Preserving Python Standard Syntax
Author: Anonymous Python Enthusiast <email@example.com>
Sponsor: Pending

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you're not a core developer, you'll need a sponsor; do you have any willing sponsor?

You may be better off first posting your idea in the "Ideas" category of discuss.python.org. (Fair warning: Most ideas tend to get a negative reception.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jella, it's a real honor to speak with you. To be honest, I'm quite shy when it comes to talking to the community (I focus more on the technical side than on human relationships). I've been working on parsers and lexers for quite some time now (in assembler, yes, the language they considered obsolete, but it's my favorite), and I've seen other community proposals to solve the problem of Python not having block comments. (I don't mean to sound arrogant, but even though I haven't read the Python source code, I understand how it works, and I know it's better to combine existing language features than to start adding new ones.) According to benchmarks, this could very likely be the fastest and most efficient way to add block comments. I hope this clarifies things a bit for you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PEP suggestion, however a sponsor is required. Even if you can find one without a "Ideas" discussion, if we merge this draft, a discussion on discuss.python.org would still be needed before submitting the PEP to the Steering Council for decision.

So let's close this for now, and please either open an "Ideas" discussion, or find a co-author who would be willing to do these things with you.

@hugovk hugovk changed the title Introduce PEP 1234 for block comments in Python PEP NNN: block comments in Python Aug 4, 2026
@hugovk hugovk closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants