What Are the Advantages of Python Over Ruby?

by HSG on Apr 03, 2014 in Articles from Software Fans

Python and Ruby, each with roots going back into the 1990s, are two of the most popular interpreted programming languages today. Ruby is most widely known as the language in which the ubiquitous Ruby on Rails web application framework is written, but it also has legions of fans that use it for things that have nothing to do with the web. Python is a big hit in the numerical and scientific computing communities at the present time, rapidly displacing such longtime stalwarts as R when it comes to these applications. It too, however, is also put to a myriad of other uses, and the two languages probably vie for the title when it comes to how flexible their users find them.

A Matter of Personality...

Teaching You Tools to Become Empowered
To build a successful business and career, you must always keep up with changes in the IT Marketplace. AWS, Office 365, LinkedIn, Sales Force, SEO, Social Media are just a few examples of where knowledge is a huge factor for success.
Training with HSG addresses your knowledge gaps and provides you with the requisite tools to outpace the competition.


That isn't to say that there aren't some major, immediately noticeable, differences between the two programming tongues. Ruby is famous for its flexibility and eagerness to please; it is seen by many as a cleaned-up continuation of Perl's "Do What I Mean" philosophy, whereby the interpreter does its best to figure out the meaning of evening non-canonical syntactic constructs. In fact, the language's creator, Yukihiro Matsumoto, chose his brainchild's name in homage to that earlier language's gemstone-inspired moniker.

Python, on the other hand, takes a very different tact. In a famous Python Enhancement Proposal called "The Zen of Python," longtime Pythonista Tim Peters declared it to be preferable that there should only be a single obvious way to do anything. Python enthusiasts and programmers, then, generally prize unanimity of style over syntactic flexibility compared to those who choose Ruby, and this shows in the code they create. Even Python's whitespace-sensitive parsing has a feel of lending clarity through syntactical enforcement that is very much at odds with the much fuzzier style of typical Ruby code.

For example, Python's much-admired list comprehension feature serves as the most obvious way to build up certain kinds of lists according to initial conditions:

a = [x**3 for x in range(10,20)]
b = [y for y in a if y % 2 == 0]

first builds up a list of the cubes of all of the numbers between 10 and 19 (yes, 19), assigning the result to 'a'. A second list of those elements in 'a' which are even is then stored in 'b'. One natural way to do this in Ruby is probably:

a = (10..19).map {|x| x ** 3}
b = a.select {|y| y.even?}

but there are a number of obvious alternatives, such as:

a = (10..19).collect do |x|
x ** 3
end

b = a.find_all do |y|
y % 2 == 0
end

It tends to be a little easier to come up with equally viable, but syntactically distinct, solutions in Ruby compared to Python, even for relatively simple tasks like the above. That is not to say that Ruby is a messy language, either; it is merely that it is somewhat freer and more forgiving than Python is, and many consider Python's relative purity in this regard a real advantage when it comes to writing clear, easily understandable code.

And Somewhat One of Performance


Python also tends to perform better than Ruby in most real-world applications. Both are very dynamic languages, but Ruby tends more toward preserving that dynamism even in the face of negative performance implications. Python has also benefited more from intense, performance-focused tweaking of its various interpreters, although Ruby has caught up in this regard somewhat in recent years. Both languages have a lot to recommend them, however.

 

Related:

How Can Business Analysts Use Python?

How to check if a directory exists in Python

How does Google use Python?

What Are The 10 Most Famous Software Programs Written in Python?

other blog entries

Course Directory [training on all levels]

Upcoming Classes
Gain insight and ideas from students with different perspectives and experiences.

Interesting Reads Take a class with us and receive a book of your choosing for 50% off MSRP.

did you know? HSG is one of the foremost training companies in the United States

Information Technology Training that enables companies to build better applications and expertly manage the software development process.

Our courses focus on two areas: the most current and critical object-oriented and component based tools, technologies and languages; and the fundamentals of effective development methodology. Our programs are designed to deliver technology essentials while improving development staff productivity.

Personalized courses for unique business and technology needs

An experienced trainer and faculty member will identify the client's individual training requirements, then adapt and tailor the course appropriately. Our custom training solutions reduce time, risk and cost while keeping development teams motivated. The Hartmann Software Group's faculty consists of veteran software engineers, some of whom currently teach at several Colorado Universities. Our faculty's wealth of knowledge combined with their continued real world consulting experience enables us to produce more effective training programs to ensure our clients receive the highest quality and most relevant instruction available. Instruction is available at client locations or at various training facilities located in the metropolitan Denver area.

Upcoming Classes

consulting services we do what we know ... write software

Design and Development
Application lifecycle management
We generate use cases, UML documentation, architect the system, create an object model, iteratively develop the system, unit and system test and modularize where necessary. These types of engagements are typically longterm and, almost always, incorporate a variety of software technologies.
If you are in need of expertise but only require the assistance of one or two engineers, the Hartmann Software Group can be of help. Instead of procuring talent by way of a placement agency who is likely to contact us, come to the Hartmann Software Group directly. You may realize some savings.
Mentor
The best way to learn is by doing.

The coaching program integrates our course instruction with hands on software development practices. By employing XP (Extreme Programming) techniques, we teach students as follows:

Configure and integrate the needed development tools

MOntitor each students progress and offer feedback, perspective and alternatives when needed.

Establish an Action plan to yield a set of deliverables in order to guarantee productive learning.

Establish an Commit to a deliverable time line.

Hold each student accountable to a standard that is comparable to that of an engineer/project manager with at least one year's experience in the field.

These coaching cycles typically last 2-4 weeks in duration.

Provide Expertise
Services for your business growth.
With the introduction of smart devices, e-marketplaces, electronic forms, SEO practices, big data, virtual office environments, media streaming and so much more, there is hardly a business whose livelihood is not, in some way, dependent upon the inclusion of such software functionality into its online presence, work environment and product offerings. Such inclusion often presents a complex array of challenges that are far beyond the expertise of the business as it demands an understanding of technological options, modular decomposition, backend systems integration and web services. Most importantly, the business requires IT talent and expertise; this is where the Hartmann Software Group shines. To that end, here is an overview of some of the services that we offer:

Business Rule isolation and integration for large scale systems using Blaze Advisor

Develop Java, .NET, Perl, Python, TCL and C++ related technologies for Web, Telephony, Transactional i.e. financial and a variety of other considerations.

Windows and Unix/Linux System Administration.

Application Server Administration, in particular, Weblogic, Oracle and JBoss.

Desperate application communication by way of Web Services (SOAP & Restful), RMI, EJBs, Sockets, HTTP, FTP and a number of other protocols.

Graphics Rich application development work i.e. fat clients and/or Web Clients to include graphic design

Performance improvement through code rewrites, code interpreter enhancements, inline and native code compilations and system alterations.

Mentoring of IT and Business Teams for quick and guaranteed expertise transfer.

Architect both small and large software development systems to include: Data Dictionaries, UML Diagrams, Software & Systems Selections and more