LinuxQuestions.org
Help answer threads with 0 replies.
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 10-02-2005, 10:54 AM   #1
servnov
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Rep: Reputation: 30
Advice on PERL vs. Python


I am getting interested in learning python or perl for my programming tasks. I know there isn't a 'best' language I just wanted some thoughts.

I have a background in C, want to have it portable to linux and win32, possible GUI design with wxgtk, general programming requiring good communication with shell interpreters (mainly bash) to modify system files is what I need.

I have often heard python is more readable, but also whitespace has meaning and I like to space and tab anywhere I please (so I am thinking perl). Also, I want to run small math codes. Which one would you guys recommend? Thanks for thoughts.
 
Old 10-02-2005, 12:59 PM   #2
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 43
My Two Cents Worth

I like and use both Perl and Python, and I think that either one would easily fulfill your needs. But there are differences, of course; as they are very different languages. In my experience, Perl gives you greater power and flexibility, and allows you to quickly write code to get the job done. Python, on the other hand, offers more structure, and lets you more easily write code that can be reused and worked into a larger framework. These are the primary differences I see. So are you more interested in writing a quick program to get the job done? If so, then I'd say Perl. But if you want to write a large and complicated program that you can easily reuse parts of later, I'd recommend Python.
 
Old 10-02-2005, 02:13 PM   #3
destuxor
Member
 
Registered: Oct 2005
Posts: 51

Rep: Reputation: 16
I completely agree what was just said, but I want to point out that if you hope to have a project run under Windows it's a lot less trouble to distribute compiled binaries than ask people to install something else first, and Python has seen a lot more compilation for Windows that Perl has. Not that there aren't ways to distribute binary software written in Perl, but it's less trouble to do so for Python.

Although...if there's ever something you need done in Perl, there's always CPAN.

What do you mean by "general programming requiring good communication with shell interpreters (mainly bash) to modify system files is what I need"? Bash isn't available on a Win32 platform (AFAIK, minus Cygwin/CoLinux), and nobody really believes Monad is going to happen. It'd be a lot easier to learn how to create a filehandle and interact with it than mess around with making system/shell commands from your software.
 
Old 10-02-2005, 02:33 PM   #4
servnov
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by destuxor

What do you mean by "general programming requiring good communication with shell interpreters (mainly bash) to modify system files is what I need"? Bash isn't available on a Win32 platform (AFAIK, minus Cygwin/CoLinux), and nobody really believes Monad is going to happen. It'd be a lot easier to learn how to create a filehandle and interact with it than mess around with making system/shell commands from your software.
I just wanted to do some system admin tasks, like cleaning up log files add such. I can just write a bash script for that so its not that big of a deal. I do want to make dirs, remove files, create files, and the like thru the language.
 
Old 10-02-2005, 02:51 PM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I'll agree with taylor_venable from a technical standpoint: both will do what you want, and both have their places.

However, from a practical perspective (including my own experience), I would suggest Python over Perl. Why? Because I find the Perl community has an unstated competition among developers: write the script in as few characters as possible. That leads to some horribly unreadable code. That doesn't mean you have to write that way, but a lot of programmers learn by example. So it's likely that code you pull from a website to study will have some of that "shorter is always better" philosophy. I struggled with a lot of it sometimes. So much that it turned me off from Perl, and I'll use Perl only if I absolutely must. Python may be developing a little of that culture as well, but it's not nearly so in-grained.

Don't get me wrong. Concise code can be a very good thing. But going too far turns concise code into cryptic code.
 
Old 10-02-2005, 02:59 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
... I find the Perl community has an unstated competition among developers: write the script in as few characters as possible. That leads to some horribly unreadable code.
I am biased, but I have to agree. I have nothing against PERL, except that many of its aficionados seem to take pride in the fact that its scripts are often difficult to read. (Note that I said "many", not "all".)

Python invites a degree of readability by enforcing the white space thing. It's really not so bad once you get used to it. I really enjoy the consistency.

FWIW, I am from the school that says: Programmers are human. Humans are dumb. Computers are smart. Write programs that other dumb humans (including yourself in a few months after not looking at it) can understand.

You may disagree and have your own reasons for choosing one over the other.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 and mardriva - what's going on? some advice please mia_dinozzo Linux - Newbie 7 11-26-2005 11:54 AM
Python or Perl? Boby Programming 2 06-12-2005 10:54 AM
Perl or Python JJX Programming 6 10-27-2004 03:58 AM
Perl or Python ! linuxlover1 Programming 13 04-19-2004 07:33 AM
Perl vs PHP, PYTHON shebang Programming 5 02-14-2004 12:13 PM

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

All times are GMT -5. The time now is 03:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration