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

后端 未结 5 766
我在风中等你
我在风中等你 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:31

    Most scripting languages use # as a comment marker so to skip automatically the shebang (#!) which specifies to the program loader the interpreter to run (like in #!/bin/bash). Alternatively, the interpreter could be instructed to automatically skip the first line, but it's way more convenient just to define # as comment marker and that's it, so it's skipped as a consequence.

提交回复
热议问题