PEP 350: Codetags

Ron Adam rrr at ronadam.com
Wed Sep 28 12:41:47 EDT 2005


Micah Elliott wrote:
> Please read/comment/vote.  This circulated as a pre-PEP proposal
> submitted to c.l.py on August 10, but has changed quite a bit since
> then.  I'm reposting this since it is now "Open (under consideration)"
> at <http://www.python.org/peps/pep-0350.html>.
> 
> Thanks!

How about an approach similar to mark up language using block comments? 
   It would require adding syntax to Python, but might be worth it.

     # Current comments would stay the same.
     #
     # These won't change.
     # Even if they are on a line by them selves or
     # in a sequence of lines.


Possible multi-line comment with optional label.

     ##[label]: comment text :##


Examples:

     ##: an in line comment with no label :##

     ##:
         A multi-line
         comment with no label.

         ##:
             The ##: and :## make it possible.
             to nest comments.

             Nesting makes it easier to comment out
             sections of code without the side effects
             that occur when using triple quotes.
         :##
     :##


     ## TODO:
         A comment with a label.

         I need to do something here.
         JANE, 9/28/05
     :##


     ## FIX ME:
         Nested comments with labels.

         ## JOE:
             I noticed if this gets stuck in a loop here.
             ## date: 9/25/05 :## :##
         ## JOHN:
             I fixed it.
             ## date: 9/28/05 :## :##
     :##


     ## INFO:
     #
     #  Existing comments
     #  wrapped in a labeled
     #  block comment.
     #
     :##


The markup form might make it easy to read labeled comments into a 
dictionary where the labels become the keys.  Then special "<field>" 
definitions wouldn't be needed.

Cheers,
Ron



More information about the Python-list mailing list