Mutliple Line Comments


#1


https://www.codecademy.com/courses/introduction-to-python-6WeG3/2/2?curriculum_id=4f89dab3d788890003000096#

Why does my comment print out in the interpreter?


Replace this line with your code. Do not remove the backticks that are above or beneath this line.


#2

That would suggest that it's not a comment. Perhaps it's a multiline string.


#3

Then how would you write multi-line comments without triple apostrophes? And why did the comment print to the console?


#4

If you would post your code, it would be easier to tell...


#5

If you did not print it then you did not print it. If somebody else printed it then that's not your problem.

Literals, including strings, get ignored if they are not used, that means that sure, strings can be used as comments.

When placed in certain locations they become docstrings instead, they get associated with that module/class/function. You can for example print the docstring for sum with: print sum.__doc__

Most text editors intended for writing code support (de)commenting lines, there really isn't much need for the syntax supporting multi-line comments. (Fro example, in vim I might type the following to comment this and the following 4 lines: 0(ctrl+v)5jI#(ESC) That makes lots and lots of sense I'm sure :p)