Why does python use unconventional triple-quotation marks for comments?

后端 未结 5 758
我在风中等你
我在风中等你 2020-12-07 17:54

Why didn\'t python just use the traditional style of comments like C/C++/Java uses:

/**
 * Comment lines 
 * More comment lines
 */

// line comments
// line         


        
5条回答
  •  攒了一身酷
    2020-12-07 18:11

    Guido - the creator of Python, actually weighs in on the topic here: https://twitter.com/gvanrossum/status/112670605505077248?lang=en

    In summary - for multiline comments, just use triple quotes. For academic purposes - yes it technically is a string, but it gets ignored because it is never used or assigned to a variable.

提交回复
热议问题