标准 Python 实现被视为编程语言还是脚本语言?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46386442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:35:48  来源:igfitidea点击:

Is the standard Python implementation considered as a programming language or a scripting language?

python

提问by Jefhunt

Is calling the standard Python implementation a Programming Language justified?

将标准 Python 实现称为编程语言是否合理?

回答by Moinuddin Quadri

As mentioned in What's the difference between Scripting and Programming Languages?article:

脚本和编程语言之间有什么区别?文章:

Basically, all scripting languages are programming languages. The theoretical difference between the two is that scripting languages do not require the compilation step and are rather interpreted. For example, normally, a C program needs to be compiled before running whereas normally, a scripting language like JavaScript or PHP need not be compiled.

基本上,所有脚本语言都是编程语言。两者之间的理论区别在于脚本语言不需要编译步骤,而是解释性的。例如,通常情况下,C 程序需要在运行前进行编译,而 JavaScript 或 PHP 等脚本语言通常不需要编译。

Applications of Scripting Languages:

脚本语言的应用

  1. To automate certain tasks in a program

  2. Extracting information from a data set

  3. Less code intensive as compared to traditional programming languages

  1. 自动化程序中的某些任务

  2. 从数据集中提取信息

  3. 与传统编程语言相比,代码密集度更低

Applications of Programming Languages:

编程语言的应用

  1. They typically run inside a parent program like scripts

  2. More compatible while integrating code with mathematical models

  3. Languages like JAVA can be compiled and then used on any platform

  1. 它们通常在父程序中运行,如脚本

  2. 将代码与数学模型集成时更兼容

  3. 像JAVA这样的语言可以编译然后在任何平台上使用

Also, as mentioned in another article Difference Between Scripting Language and Programming Language:

另外,正如另一篇文章“脚本语言和编程语言之间的区别”中所述

A scripting language generally sits behind some programming language. Scripting languages generally have less access to the computer's native abilities since they only run on a subset of the programming language.Scripting languages are generally slower than programming languages.

脚本语言通常位于某种编程语言之后。脚本语言通常对计算机本机能力的访问较少,因为它们只在编程语言的一个子集上运行。脚本语言通常比编程语言慢。

More details from Quora's post Why is Python called "a scripting language"?:

Quora 帖子中的更多详细信息为什么 Python 被称为“一种脚本语言”?

Just because something is interpreted doesn't mean it's a scripting language -- after all, Python can be compiled. And standard Python compiles Python code into bytecode and interprets that, just like Java. But you never see Java called a "scripting language." Also, there are C interpreters out there. If anyone cares to put in the effort, any language can be either compiled or interpreted.

仅仅因为某些东西被解释并不意味着它是一种脚本语言——毕竟,Python 可以被编译。标准 Python 将 Python 代码编译为字节码并对其进行解释,就像 Java 一样。但是您永远不会看到 Java 被称为“脚本语言”。此外,还有 C 解释器。如果有人愿意付出努力,任何语言都可以编译或解释。

Conclusion

结论

Python is considered a scripting language because of a historical blur between scripting languages and general purpose programming languages. In fact, Python is not a scripting language, but a general purpose programming language that also works nicely as a scripting language.

由于脚本语言和通用编程语言之间的历史模糊,Python 被认为是一种脚本语言。事实上,Python 不是一种脚本语言,而是一种通用编程语言,也可以很好地用作脚本语言。