Python Forum
Algorithm for extracting comments from Python source code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Algorithm for extracting comments from Python source code
#6
Oficially, only the # ... comments exist in Python, but you can't prevent people from overusing the syntax by cluttering the code with strings. This could be done in many strange ways, for example
((
'''Here is a new strange
comment included in parenthesis'''),

"""It really does nothing useful, so
it's probably a comment, but it is impossible to guess"""
)
Also note that there are other paired delimiters in Python, namely { } and [ ]
« We can solve any problem by introducing an extra level of indirection »
Reply


Messages In This Thread
RE: Algorithm for extracting comments from Python source code - by Gribouillis - Feb-28-2024, 09:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  delivery exe without source code py loky62 2 424 Apr-04-2024, 05:47 PM
Last Post: loky62
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 7,527 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  How do I add comments from a text-file to an array of folders? clausneergaard 2 1,865 Feb-08-2023, 07:45 PM
Last Post: Larz60+
  python move specific files from source to destination including duplicates mg24 3 1,163 Jan-21-2023, 04:21 AM
Last Post: deanhystad
  Python Snippets Source kucingkembar 0 676 Oct-18-2022, 12:50 AM
Last Post: kucingkembar
  Inserting line feeds and comments into a beautifulsoup string arbiel 1 1,248 Jul-20-2022, 09:05 AM
Last Post: arbiel
  Correct the algorithm of image filter code saoko 6 2,123 May-08-2022, 05:06 PM
Last Post: saoko
  Rock paper scissors in python with "algorithm" Agat0 23 6,340 Mar-01-2022, 03:20 PM
Last Post: Agat0
  Long-term stable source to get news headlines with Python? sandufi 4 2,035 Dec-23-2021, 09:48 AM
Last Post: sandufi
  Delete multiple comments with a single API call (facebook) Ascalon 0 2,375 Dec-04-2021, 08:33 PM
Last Post: Ascalon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020