【发布时间】:2011-03-30 04:40:37
【问题描述】:
我遇到了这个很棒的comparison chart between Python & Ruby。
我正在寻找一种真正融合了 Python 和 Ruby 的编程语言(稍微倾向于 Python)。
我真的很喜欢在 Ruby 中一切都是对象(与 Python 不同)。但是,我真的很喜欢 Python 中的东西是不可变的,因此代码维护和内置的 Unicode 支持更容易(不像 Ruby)。
有谁知道一种兼具 Python 和 Ruby 优点的优秀编程语言。
我已尝试在下面列出功能。
Language Features
Everything's an Object YES***
Namespaces yes
Constants YES***
Generators yes
Iterators yes
Coroutines yes
Continuations no
Classes
Multiple Inheritance NO***
Interfaces no
Class Includes* no
Nested Classes yes
Properties yes
Operator Overloading yes
Functions
First-Class Functions yes
Anonymous Functions yes
Keyword Arguments yes
Closures yes
Decorators yes
Collection Objects
Tuples NO***
Lists yes
Hashes yes
Strings
String Type yes
Char Type no
Symbol Type no
Immutable yes
Interned yes
Heredocs no
Multiline Strings yes
Unicode Support yes
Regular Expressions
Regex Literal no
Named Groups yes
Lookaheads yes
Lookbehinds yes
Yes/No Pattern yes
Unicode Support yes
Lua 看起来很有趣,但我很难找到足够的信息来确定它是否是 Python 和 Ruby 之间的良好中间语言。
【问题讨论】:
-
元组是 Python 最强大的元素之一。为什么不想要元组?
-
Python 中的一切不都是对象吗?
-
@Javier:是的,我相信是的。
-
你想用这种语言做什么? Python 和 Ruby 都是非常优秀的通用语言,因此很难看出加入它们的目的是什么......
-
你能解释一下你的意思是“内置的Unicode支持”吗?特别是,您能否解释一下 Ruby 内置的多语言支持(包括但不限于对 UTF-8、UTF-16LE、UTF-16BE、UTF-32LE 和 UTF-32BE 的内置支持,即所有 Unicode -当前使用的编码)是不是“内置Unicode支持”吗?另外,为什么说 Python 是不可变的? Python 和 Ruby、C、Java 等一样不纯。如果你想要不变性,试试 Clojure。
标签: python ruby programming-languages lua