1. Computing

What is Python?

By

6 of 7

How does Python compare to Ruby?

Python is frequently compared to Ruby. Both are interpreted and therefore high-level. Their code is implemented in such a way that one need not understand all of the details. They are simply taken care of.

Both are object-oriented from the ground up. Their implementation of classes and objects allow for greater re-use of code and ease of maintainability.

Both are general purpose. They can be used for the simplest of tasks like converting text or for much more complicated matters like controlling robots and managing major financial data systems.

There are two major differences between the two languages: readability and flexibility. Due to its object-oriented nature, Ruby code does not err on the side of being squirrely like Perl or PHP. Instead, it errs in being so obtuse that it is often unreadable; it tends to presume upon the programmer's intentions. One of the chief questions asked by students learning Ruby is "How does it know to do that?". With Python, this information is typically plain in the syntax. Aside from enforcing indentation for readability, Python also enforces transparency of information by not assuming too much.

Because it does not assume too much, Python allows for easy variation from the standard way of doing things when needed while insisting that such variation be explicit in the code. This give power to the programmer to do what is necessary while ensuring that those who read the code later can make sense of it. Very often, once a programmer uses Python for a few tasks, they find it hard to use anything else.

  1. About.com
  2. Computing
  3. Python
  4. Beginning Python
  5. Python Compared - How does Python compare to Ruby?

©2014 About.com. All rights reserved.