Why to use three set of quote ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why to use three set of quote ?

20th Jan 2017, 3:08 PM
Sagar Patel
Sagar Patel - avatar
2 Answers
+ 2
This is also and mainly called 'doc string' and is a way to define inline documentation at same time you write comments in code: https://www.python.org/dev/peps/pep-0257/ Conversly than comments, they are actually available as real strings inside code... They must not necessarly be enclosed by triple quote ( they are strings ), but it's a convention, which allow multiline strings ^^
20th Jan 2017, 6:02 PM
visph
visph - avatar
+ 1
This is the only way to nicely do multiline strings and this is the way block comments are done in Python. You definitely don't need to use this aspect of the language but your code won't really be Pythonic and you wouldn't be following standard conventions.
20th Jan 2017, 3:47 PM
James Durand
James Durand - avatar