LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2006, 01:30 PM   #1
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Rep: Reputation: 30
Perl vs. Ruby vs. Python


Hi all!

I want to learn perl or ruby or python but I do not know which one is the best. I know quite much about these languages, escpecially about perl and ruby but I have already heard of python. So the most important thing for me is the speed. I do not know which one is the fastest. And it was great if I could compile the source code into a native executable. I do not know whether is it possible or not but it was great.
So please help me to answer rhese questions..
 
Old 09-24-2006, 01:44 PM   #2
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

There is a comparison chart at http://en.wikipedia.org/wiki/Compari...ming_languages

and there are benchmarks results at http://shootout.alioth.debian.org/

Best wishes, and let us know what you finally choose and why ... cheers, makyo
 
Old 09-24-2006, 04:13 PM   #3
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
So I won't learn Ruby tough it is quite simple but hardly readable, like perl. Python is very very easily readabla but a lot slower. I do not know why but I do not care. I do not want to write an OS in perl or python so probably I will learn python because it is OOP not like perl. Perl is much rather like PHP and I do not think I need one more sripting language. ^_^ So Python is the final choice. Somebody said that harware is cheap, programmer is expensive. Python, python, python. I hope I do not do too big mistake.
 
Old 09-24-2006, 04:19 PM   #4
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
I have one more question:
Is there a good IDE for Python? Or a module for Eclipse?
 
Old 09-24-2006, 04:56 PM   #5
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Quote:
Originally Posted by vargadanis
Hi all!

I want to learn perl or ruby or python but I do not know which one is the best. I know quite much about these languages, escpecially about perl and ruby but I have already heard of python. So the most important thing for me is the speed. I do not know which one is the fastest. And it was great if I could compile the source code into a native executable. I do not know whether is it possible or not but it was great.
So please help me to answer rhese questions..
Before you bother, take a look at these articles.

http://www.perl.com/pub/a/2001/06/27/ctoperl.html
http://www-128.ibm.com/developerwork...y/l-psyco.html

This is a universal truth in life, easy always has a cost.
In this case, the flexibility and expressiveness per line ratio have increased because other programmers have already done some of the hard work for you, but you loose some performance.

But if its any comfort, I will refer to this quoute here.

Quote:
Python is usually fast enough for what you want it to do. Ninety percent of the concerns that novice programmers express about the execution speed of an interpreted/byte-compiled language like Python are simply naive. On modern hardware, most non-optimized Python programs run as fast as they need to, and there is really no point in spending extra programming effort to make an application run faster.
If the differences in speed between any of these interpretations are more than academic to you, then you would be using C.

On the other hand, theres always a desire for the ease of use from a language like python, but the speed execution of a C program. While it would be nice in certain respects if perl/python produced native executables, it would'nt necessarily be any faster unless some things hinted in http://www.perl.com/pub/a/2001/06/27/ctoperl.html
were to happen. Considering what it took just to make the interpreters, it doesn't look like an overnight effort. To put things perspective look at GCC. That was built using a small language. Perl/Python/Ruby are'nt exactly small.

However that doesn't prevent from extending the language with speed-optimized C modules. Python, in particular makes this easy to do.

Take a look at
http://www.geocities.com/foetsch/pyt...thon.htm#intro

Ofcourse I'm a being a bit biased. You can also do this in perl. In fact theres a whole thick book on it.
http://www.manning.com/jenness/
You'll notice that perl is pretty good for producing thick books.
 
1 members found this post helpful.
Old 09-24-2006, 05:10 PM   #6
extrasolar
Member
 
Registered: Feb 2004
Location: Northamptonshire, UK
Distribution: Windows XP, Arch Linux
Posts: 131

Rep: Reputation: 16
I'm just about to start learning Python. Python seems like a good choice: it's easy to read, fairly powerful and, compared to some other languages (such as C, C++ and Java), it doesn't seem too complicated.

I've started learning C, C++, C# and Java but I always find that they get too complex for a beginner such as myself.

So I'm gonna learn Python and then move up to perhaps C++ or Java.

Last edited by extrasolar; 09-24-2006 at 05:12 PM.
 
Old 09-24-2006, 05:18 PM   #7
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Quote:
Originally Posted by vargadanis
So I won't learn Ruby tough it is quite simple but hardly readable, like perl. Python is very very easily readabla but a lot slower. I do not know why but I do not care. I do not want to write an OS in perl or python so probably I will learn python because it is OOP not like perl. Perl is much rather like PHP and I do not think I need one more sripting language. ^_^ So Python is the final choice. Somebody said that harware is cheap, programmer is expensive. Python, python, python. I hope I do not do too big mistake.
You must have posted that in the middle of my big post. But I happy you picked your language. And you picked python.

You are right about python programs generally being more readable. One thing I've noticed between programming in perl and python. Its very easy to write a perl program, which is why they're pretty much a dime a dozen. But reading one on the other hand...it can be painful.
Its almost like a version of C++, thats easier to program with, but without the discipline carried over from learning a less forgiving language. And if you've seen novice C++ programmers writing 500 lines for an 80 line homework assignment, you'll know what I'm talking about. Not a language flaw really. Just noticing habits from typical perl programmers. Having 20 different obscure operators that do the same thing doesn't appear to aid readability.
 
Old 09-24-2006, 05:20 PM   #8
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.
Quote:
Originally Posted by vargadanis
I have one more question:
Is there a good IDE for Python? Or a module for Eclipse?
See http://en.wikipedia.org/wiki/Compari...t_environments
which points also to
http://en.wikipedia.org/wiki/List_of...t_environments

Wikipedia and Google are your friends ... cheers, makyo
 
Old 09-24-2006, 07:24 PM   #9
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by slantoflight
You must have posted that in the middle of my big post. But I happy you picked your language. And you picked python.

You are right about python programs generally being more readable. One thing I've noticed between programming in perl and python. Its very easy to write a perl program, which is why they're pretty much a dime a dozen. But reading one on the other hand...it can be painful.
Its almost like a version of C++, thats easier to program with, but without the discipline carried over from learning a less forgiving language. And if you've seen novice C++ programmers writing 500 lines for an 80 line homework assignment, you'll know what I'm talking about. Not a language flaw really. Just noticing habits from typical perl programmers. Having 20 different obscure operators that do the same thing doesn't appear to aid readability.
I am sorry. I did not want to interrupt you.
Painful reading... That is what I want to avoid. I have some experience in reading other people's PHP code and it is usually much more complicated and less readable than they should be. So this was the primary motivating force to learn python. And I know how painful it is to learn C and C++. I am quite good at C (just the basics, like I/O, file management) but sometimes I cannot read my own codes and it takes time to see what is happening now. But I am used to it now. I am thinking in C not in python so the first 200 lines of program code I wrote today were really painful but I am quite satisfied with the result. But! I am not sure this is what I am seeking.
To compare I tried out Perl too. I used the std libraries and wrote the same program. The difference is shocking. As I am used to C and the "{}" marks, it wasn't less readable for me than the python code. I accept that these marks makes it a bit difficult to read but I learned to ignore them. But it seems to be more logical to use the for(i=0; i<10; i++){} than using the for i in range(0,9): staff... or sth similar
So now I decided something new... I won't learn any of these languages. I know how to use pearl. Or at least the basics. I know PHP so now it is time to learn something very complicated.
I decided I am gonna dig into C and C++. I wanna learn these because they are the most powerful programming languages so far.
They are platform independent and everything important is written in C or C++. Have you ever seen a kernel module or a driver written in Pearl or Python or even in Ruby? Sound strange, doesn't it? The next step is gonna be asm.
So what do you think? Is there a point in learning Pearl or Python if I can learn C with the same effort?
 
Old 09-24-2006, 11:17 PM   #10
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Quote:
Originally Posted by vargadanis
So what do you think? Is there a point in learning Pearl or Python if I can learn C with the same effort?
Learn as many languages as you can. And no, learning Perl/Python is not the same effort as C. Not by a long shot.
 
Old 09-25-2006, 05:16 AM   #11
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
My opinion: Perl is a PITA plain and simple. Always had troubles with it. I have tried repeatedly to 'get it' but it always just hurts my head, and I never get anywhere.

Python and Ruby however are both a joy. I learned Python first and I love the syntax (including forced indentation which most hate) but have found myself writing everything in Ruby lately because I love the 'everything is an object' paradigm. You may think Python is OOP til you try Ruby...

Both languages are great for writing complex apps in a ridiculously small amount of LOC. And as for speed, don't get caught up in premature optimization. If it runs fast enough, it's fast enough, no matter what.
 
Old 09-25-2006, 06:53 AM   #12
pankaj99
Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 47

Rep: Reputation: 15
I know how to program in C and c++.
how much time it will take me to learn perl or python?
 
Old 09-25-2006, 07:00 AM   #13
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
I know how to program in C and c++.
how much time it will take me to learn perl or python?
5 minutes... here is a great introduction to Python for those who know how to program:
http://linux.duke.edu/~mstenner/free.../html/toc.html

The question is how long will it take you to unlearn all that C/C++ damage
 
Old 09-25-2006, 07:23 AM   #14
X.Cyclop
Member
 
Registered: Jun 2006
Location: Tlv
Distribution: Arch!
Posts: 120

Rep: Reputation: 21
Why Python?
Python IDEs

 
Old 09-25-2006, 09:03 AM   #15
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
Apparently I'm not the only that likes python.
 
  


Reply

Tags
language



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python or Perl drdroid Programming 29 12-22-2006 09:54 AM
perl vs python yenonn Programming 6 08-01-2006 05:44 AM
Perl or Python JJX Programming 4 04-17-2006 02:42 PM
Python or Perl? Boby Programming 2 06-12-2005 10:54 AM
Perl or Python JJX Programming 6 10-27-2004 03:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration