Create multiline comments in Python?

Create multiline comments in Python? {Celebrity |Famous |}%title%{ Net Worth| Wealth| Profile}
YouTube Excerpt: PLEASE COMMENT, SUBSCRIBE, AND SHARE!!! Way to create multiline comments in Python? Inspired by: http://stackoverflow.com/questions/7696924/way-to-create-multiline-comments-in-python Best Answer Section: " up vote 847 down vote accepted You can use triple-quoted strings. When they're not a docstring (first thing in a class/function/module), they are ignored. ''' This is a multiline comment. ''' Guido van Rossum (creator of Python) tweeted this as a "pro tip". However, Python's style guide, PEP8, favors using consecutive single-line comments, and this is also what you'll find in many projects. Editors usually have a shortcut to do this easily. shareimprove this answer edited Jun 30 at 14:27 Martijn Pieters♦ 511k7513581508 answered Oct 8 '11 at 12:58 Petr Viktorin 26.4k24660 7 Hm. I put a huge multiline string in a python script test.py just to see. When I do import test, a test.pyc file is generated. Unfortunately, the pyc file is huge and contains the entire string as plain text. Am I misunderstanding something, or is this tweet incorrect? – unutbu Oct 8 '11 at 13:18 16 @unutbu, if it was the only thing in the file, it was a docstring. Put some code before it and it'll disappear from the pyc. I edited the answer and put „module“ to the list of things that have docstrings. – Petr Viktorin Oct 8 '11 at 13:21 18 I don't like multiline string as comments. Syntax highlighting marks them as strings, not as comments. I like to use a decent editor that automatically deals with commenting out regions and wrapping multiline comments while I type. Of course, it's a matter of taste. – Sven Marnach Oct 8 '11 at 13:31 37 As a convention I find it helpful to use """ for docstrings and ''' for block comments. In this manner you can wrap ''' around your usual docstrings without conflict. – Roshambo Dec 18 '12 at 20:03 3 While you can use multi-line strings as multi-line comments, I'm surprised that none of these answers refer to the PEP 8 subsection that specifically recommends constructing multi-line comments from consecutive single-line comments, with blank # lines to distinguish paragraphs. – Air May 21 '14 at 19:32 "

PLEASE COMMENT, SUBSCRIBE, AND SHARE!!! Way to create multiline comments in Python? Inspired...

Read Full Article 🔍

Curious about Create Multiline Comments In Python?'s Color? Explore detailed estimates, income sources, and financial insights that reveal the full picture of their profile.

color style guide

Source ID: VVL9rsXA10M

Category: color style guide

View Color Profile 🔓

Disclaimer: %niche_term% estimates are based on publicly available data, media reports, and financial analysis. Actual numbers may vary.

Sponsored
Sponsored
Sponsored