views:

261

answers:

2

I came across this great comparison chart between Python & Ruby.

I'm looking for a programming language that is truly a blend between Python and Ruby (with a slight lean towards Python).

I really like in Ruby that everything is an object (unlike Python). However, I really like in Python that things are immutable, so that code maintenance is much easier as well as built-in Unicode support (unlike Ruby).

Does anyone know of a good programming languages that has the best of both Python and Ruby.

I've attempted to make a feature listing below.

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 looks interesting, though I'm having a difficult time finding enough information on it to determine if it's a good middle language between Python and Ruby.

+2  A: 

I don't understand what you mean by "everything is an object", as far as I know Python has no primitives either (you can derive from the basic integer type in Python 3 for example.)

I've used both, and although I prefer Python, Ruby is no doubt a very potent language, so instead of going by a chart, install both and see which you prefer programming in. If you still can't decide, look at the surrounding environment (how good is the standard library, tools, docs etc.)

Ruby and Python has different "idioms", and underlying philosophies which most probably differs on some points, which might be worth investigating.

Skurmedel
"everything is an object" means that classes and functions are instances too.
Odomontois
Well they are, `type(a)` where a `def a(): pass` yields `<class 'function'>`, `type(int)` yields `<class 'type'>`. A class is an instance of type.
Skurmedel
@Skurmedel - Even better, a class can be an instance of anything, it's just that most classes are instances of type. So you can have metaclasses.
Omnifarious
In Python, you can't do things like: 5.toString()
TeddyB
Because 5 is an immutable object. Just type dir(5) at the interactive prompts, and you'll see the methods defined on it. And, by the way, you can do something like getattr(5, '__repr__')() to get the same you were talking about.
Roberto Liffredo
@TeddyB - that is only because the python parser interprets `5.` as a floating point number. This works: `(5).__str__()`
Dave Kirby
Omnifarious: Yup, you can do some nice things with metaclasses.
Skurmedel
I think I know what you mean by "everything's an object", you mean they derive from Object in Ruby. That is true, but in the sense of the object model, everything is still an object in Python as it is in Ruby.
Skurmedel
Python has only two primitives: `type` and `object`. They are like Python's yin and yang; `type` inhertis from `object` but `object`'s metaclass is `type`. Together they form the base of the Python (new-style classes) object system.
kaizer.se
A: 

Check out groovy. Also it has great feature that have Python and Ruby and some other popular langages, but most of dynamic languages lacks - IDE support ( by NetBeans, Eclipse and IDEA ). Differences from python and differences from ruby

Odomontois