📜  Ruby vs Python

📅  最后修改于: 2021-01-08 12:54:04             🧑  作者: Mango

Ruby与Python

Ruby和Python编程语言之间有许多异同。

相似之处

  • 它们都是高级语言。
  • 它们都是服务器端脚本语言。
  • 两者都用于Web应用程序。
  • 两者都可以在多个平台上工作。
  • 两者都有清晰的语法并且易于阅读。
  • 两者都使用称为irb的交互式提示。
  • 对象是强类型和动态类型的。
  • 两者都使用嵌入式文档工具。

差异性

Terms Ruby Python
Definition Ruby is an open source web application programming language. Python is a high level programming language.
Object Oriented Fully object oriented programming language. Not fully object oriented programming language.
Developer Yukihiro Matsumoto in 1990s. Guido Van Rossum in 1980s.
Developing Environment EclipseIDE is supported. multiple IDEs are supported.
Libraries It has smaller library than Python. Has larger range of libraries.
Mixins Mixins are used. Mixins can’t be used.
Web frameworks Ruby on Rails Django
Community Mainly focused on web. Focussed in academia and Linux.
Usage Apple
Github
Twitter
Groupon
Shopify
ThemeForest
Google
Instagram
Mozilla Firefox
The Washington post
Yahoo
Shopzilla
Built-in classes Built-in classes can be modified Built-in classes can’t be modified
elseif elsif elif
Unset a variable Once a variable is set you can’t unset it back . It will be present in the symbol table as long as it is in scope. del statement help you to delete a set variable.
yield keyword It will execute another function that has been passed as the final argument, then immediately resume. It returns execution to the scope outside the function’s invocation. External code is responsible for resuming the function.
Anonymous functions Support blocks, procs and lambdas. Support only lambdas.
Functions Doesn’t have functions. It has functions.
Tuples It doesn’t support tuples. It support tuples.
switch/case statement It support switch/case statement. It doesn’t support switch/case statement.
lambda function Its lambda functions are larger. It support only single line lambda function.
Inheritance Support single inheritance. Support multiple inheritance.