LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-25-2017, 10:43 PM   #1
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Python vs. Perl


I'm wondering what people's thoughts are about Python vs. Perl as a scripting language? I consider myself a quite good Perl programmer (self-taught and a lot of on-the-job experience) and I took a Python class at NYU.

Frankly, Python didn't really do anything for me. I'd rather code in Perl any day. What is the attraction so many have to Python? It's a bit stricter and therefore easier to debug, but that's my only thought...

Last edited by Laserbeak; 04-25-2017 at 10:45 PM.
 
Old 04-25-2017, 10:45 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,242

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Quote:
Originally Posted by Laserbeak View Post
easier to debug
That's an incredibly significant advantage in the real world.

Last edited by dugan; 04-25-2017 at 10:49 PM.
 
1 members found this post helpful.
Old 04-25-2017, 10:47 PM   #3
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Original Poster
Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by dugan View Post
In addition to that, it also has an unusually well-thought-out and comprehensive standard library.
Yeah, but Perl has libraries for practically everything! Except maybe making you a cup of coffee!
 
Old 04-25-2017, 10:49 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,242

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Quote:
Originally Posted by Laserbeak View Post
Yeah, but Perl has libraries for practically everything! Except maybe making you a cup of coffee!
Yeah, I deleted that point because I knew the counterargument was CPAN.
 
1 members found this post helpful.
Old 04-25-2017, 10:58 PM   #5
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Original Poster
Rep: Reputation: 143Reputation: 143
I think the one thing I really HATED about Python was its reliance on whitespace for blocks of code instead of the usual braces or BEGIN and END.
 
2 members found this post helpful.
Old 04-26-2017, 02:10 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,332
Blog Entries: 3

Rep: Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727
Yeah, python would be ok if not for the whitespace problems. For me, that stops me from enjoying it enough to use it. I really appreciate the flexibility of perl and, of course, the scope of what's in CPAN.
 
Old 04-26-2017, 02:16 AM   #7
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
I'm interested in learning Perl, but I really don't know where to begin. Perl 5 ? Perl 6 ? Not sure.

Otherwise, Perl is probably quite good.

I personally find Python a little bit overkill for many tasks, and fall back on BASH for system tasks that I want to script. It may or may not be as fast, but sometimes it just makes more sense.
 
Old 04-26-2017, 02:20 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,332
Blog Entries: 3

Rep: Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727Reputation: 3727
Quote:
Originally Posted by notKlaatu View Post
I'm interested in learning Perl, but I really don't know where to begin. Perl 5 ? Perl 6 ? Not sure.
Perl 5 and Perl 6 are actually different languages. If you're looking just to get started, I'd say Perl 5 and focus on perl regular expressions. That's what it's best at and those are the most useful and are going to be mostly portable anyway as nearly all languages now have 'PCRE' either as modules or built-in.
 
1 members found this post helpful.
Old 04-26-2017, 02:25 AM   #9
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by Laserbeak View Post
I think the one thing I really HATED about Python was its reliance on whitespace for blocks of code instead of the usual braces or BEGIN and END.
I thought this at first, having been programming for nigh on 30 years before I met Python, but have now come to enjoy the way Python is laid out. Much simpler and cleaner to my eyes. Each to his/her own.
 
Old 04-26-2017, 03:12 AM   #10
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Original Poster
Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by notKlaatu View Post
I'm interested in learning Perl, but I really don't know where to begin. Perl 5 ? Perl 6 ? Not sure.
Perl 5 definitely. Perl 6 is nowhere near becoming mainstream and there's a question whether it ever will.
 
1 members found this post helpful.
Old 04-26-2017, 04:59 AM   #11
camp0
Member
 
Registered: Dec 2016
Location: Dublin
Distribution: Fedora
Posts: 70

Rep: Reputation: 4
I have experience working with perl and python and I would say that I will never use perl on a project, and if I found perl code I will rewrite to python
 
Old 04-26-2017, 05:10 AM   #12
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
Quote:
Originally Posted by camp0 View Post
I have experience working with perl and python and I would say that I will never use perl on a project, and if I found perl code I will rewrite to python
Any particular reason why?

My only "issue" with Python is its lack of scope. I really wish Py3k had introduced at least the *option* to use scope delimiters. I don't care how pretty Python code is, after a few levels of indentation, it gets confusing to figure out what parents what.
 
1 members found this post helpful.
Old 04-26-2017, 05:19 AM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
Quote:
Originally Posted by notKlaatu View Post
I'm interested in learning Perl, but I really don't know where to begin. Perl 5 ? Perl 6 ? Not sure.
I went to LCA in early 2000's and asked the same question. Got basically the same answer you just did.

Mind, python also has a incompatible release cross-over.

As if there aren't enough new languages coming out all the time.
 
Old 04-26-2017, 08:08 AM   #14
camp0
Member
 
Registered: Dec 2016
Location: Dublin
Distribution: Fedora
Posts: 70

Rep: Reputation: 4
Quote:
Originally Posted by notKlaatu View Post
Any particular reason why?

My only "issue" with Python is its lack of scope. I really wish Py3k had introduced at least the *option* to use scope delimiters. I don't care how pretty Python code is, after a few levels of indentation, it gets confusing to figure out what parents what.
The main reason is that I find hard to read the code. I remember that we got a script of 300.000 lines of perl and was a pain and nobody wanted to touch it. Another reason to not use perl is that if you want to mix with other libs I found more useful libs under python and if you need to mix with c or c++ is easy than in perl.
 
Old 04-26-2017, 08:30 AM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,673
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
The languages are subtly different – indentation aside.

It's clear that Python's designer was familiar with LISP. There is a lot of list-processing mojo built into it.

Likewise, Perl shows an unmistakable influence of awk, which it was (in one sense) "built to replace."

Functionally, both languages are efficient ... well, except for Perl-6, which decidedly isn't ... and are well-supported by contributed libraries.

The contributed libraries are really "what the fuss is about." Many applications are constructed by piecing together objects and subsystems which are built and maintained by other people. (So you can "write a complete HTTP server using one line of code," for instance.) Perl, in particular, will not only install a package but rigorously test it on your machine before making it available for your use.

I simply believe that you should make it your business to familiarize yourself with present and emerging languages – because, well, "it is 'your business!'" (Programming languages happen to be a special interest of mine.) You can fully expect to encounter a wide variety of programming languages in use, simultaneously, at any "shop" you might work for or set up. At some point when beginning a new project you'll make the "fateful decision" of which language to use. (And every programmer who follows you will throw darts at your picture on their wall.) But, most of the time, there is no meaningful "versus." You'll continue the project in whatever language was originally picked – most of the time. (However, sometimes several tools are used in the context of a single project, both client-side and server-side. It can get nasty.)

Last edited by sundialsvcs; 04-26-2017 at 08:38 AM.
 
2 members found this post helpful.
  


Reply



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 vs perl doughyi8u Programming 14 03-03-2016 11:03 AM
Python related: How to access a Perl script behind a firewall from Python? vxc69 Programming 8 12-14-2010 07:32 AM
Perl Vs python knockout_artist Linux - Newbie 6 10-15-2008 11:06 AM
My needs: Perl vs. Python dave201 Programming 25 08-11-2007 11:13 PM
Perl or Python ! linuxlover1 Programming 13 04-19-2004 07:33 AM

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

All times are GMT -5. The time now is 08:44 PM.

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