How to correctly comment out several lines in Python language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to correctly comment out several lines in Python language?

Python programming

20th Dec 2016, 9:39 PM
🇨🇿 • 𝙈𝙞𝙧𝙤𝙨𝙡𝙖𝙫 𝘽𝙪𝙧𝙙𝙖
🇨🇿 • 𝙈𝙞𝙧𝙤𝙨𝙡𝙖𝙫 𝘽𝙪𝙧𝙙𝙖 - avatar
4 Answers
+ 2
""" code to comment (im not sure about this) """ not commented code
20th Dec 2016, 9:55 PM
Qoutroy Stensiö
Qoutroy Stensiö - avatar
0
If you're using Sublime or Atom, select the lines, and press Ctrl+/
20th Dec 2016, 10:18 PM
Rishi Anand
Rishi Anand - avatar
0
I know the method (""" commented lines... """) and many programmers using it, but I read somewhere that this method isn't recommended... :) I don't know why...
21st Dec 2016, 5:30 AM
🇨🇿 • 𝙈𝙞𝙧𝙤𝙨𝙡𝙖𝙫 𝘽𝙪𝙧𝙙𝙖
🇨🇿 • 𝙈𝙞𝙧𝙤𝙨𝙡𝙖𝙫 𝘽𝙪𝙧𝙙𝙖 - avatar
0
Using triple quotes is not recommended as it is mainly used in the doc strings of classes or methods/functions which can in turn be used to create documentation in your code. Unfortunately it is best in python to use # on each line. Fortunately many good editors like @Rishi Anand mention and also Pycharm (and even VIM of you configure it) have a short cut using ctrl+/
21st Dec 2016, 9:54 AM
Elric Hindy
Elric Hindy - avatar