Monday, September 14, 2015

Python Vs Ruby - Single window Comparison information



                                     Python & Ruby 



Python vs Ruby

Ruby and Python are both agile, interpreted languages with an object oriented design and very large communities. Although the languages share some ideas, syntax elements and have almost the same features the two communities have nothing in common.


Python 

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). 

Ruby
Ruby is a dynamic ,reflective ,object-oriented , general - purpose programming language. It was Ruby is a designed and devloped in the mid-1990s by Yukihiro "Matz" Matsumoto in japan . According to it's authorss, Ruby was influenced by Perl,Smalltalk,Eiffel,Ada and Lisp.

 Comparison between Ruby and Python 

comparison between Ruby vs Python

How are they different?

The Language:

The Ruby on Rails web framework is built using the Ruby programming language while the Django web framework is built using the Python programming language.

This is where much of difference lies. The two languages are visually similar but are worlds apart in their approaches to solving problems.

Ruby is designed to be infinitely flexible and empowering for programmers. It allows Ruby on Rails to do lots of little tricks to make an elegant web framework. This can feel even magical at times but this flexibility can be good and bad at times. Sometimes code works when you didn’t expect it to and leaves you feeling really impressed. Other times the Ruby magic can make it very hard to track down bugs for hours.

Python takes a more direct approach to programming. It’s main goal is to make everything obvious to the programmer. This sacrifices some of the elegance that Ruby has but gives Python a big advantage when it comes to learning to code and debugging problems.

One great example showing the difference here is working with time in your application. Imagine you want to get the time one month from this very second. Here is how you would do that in both languages


Ruby
require 'active_support/all'
new_time = 1.month.from_now

Python
from datetime import datetime
from dateutil.relativedelta import relativedelta
new_time = datetime.now() + relativedelta(months=1)

1 comment: