【发布时间】:2017-05-19 10:09:44
【问题描述】:
(请注意,在这个问题中,我将比较 Python 和 C#)
我今天想到了一个有趣的问题, 在 C# {} 中,大括号用于定义代码块,在 Python 中,空格缩进用于定义代码块。 我很想知道这是否对编译器速度有任何影响。
Python:
x = 1
if x == 1:
# indented four spaces
print("Hello World")
C#
x = 1
if(x == 1)
{
Console.WriteLine("Hello World");
}
我知道这两个编译器都是为了处理指定的语法而创建的,但是使用不同的代码块标识会对编译器不利吗?
【问题讨论】:
标签: c# python compilation compiler-construction