Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
Q - Should I use Perl or Python?

An interesting question posed to me today - and not for the first time. And not for the first time, my answer had to be "tell me more about your application, and about the people who will be writing and maintaining it".

Python v PerlA comparative diagram on the board provides some help - but of course what's important to one organisation isn't important to another, so conclusions will differ. What did we come up with?

Perl is the ultimate "glueware" with the ability to link to virtually anything - it's been hevily used for a long time and is designed to be able to talk to technologies old and new. Python connectivity's pretty good too but it's not got quite the same wide range as Perl.

Perl has been provides with many ways of doing the same thing. Now while that's great in theory (and it's great in an environment where there are people spending most of their time writing and maintaining Perl, and they know the subtle differenceces), it's something of a nightmare in a scenario where code has been written by someone who's perhaps on holiday or has moved on, and/or where a particular way of doing something has been chosen because it's what the particulare code happened to know. Python, on the other had, has intentionally got a very limited number of ways of doing things - "that's a good alternative" was NOT used as an excuse to add something to the language.

Perl assumes you know what you are doing. Which if you do is fantastic - code can be written very fast indeed and got working very quickly - "far faster than in any other languagei" I could say ... but then if you're not entirely sure what you're doing Perl has some lovely traps that can extend you debugging cycle if you don't know the language very well, to the extent that development ends up being slower than Python.

Both languages include documentation systems - there's Perl's POD and Python's docstrings - and I'm delighted that both languages have something like this available, for it's important that your programs contain the executable code and programmer's comments anduser instructions.

Both languages originated in 1988. To remind you how long ago that is, it's the year of Perestroika (economic restructuring) in the USSR, and that same nation started their withdrawl from Afghanistan that year. Wimbledon won the FA Cup, and Stefan Edberg (now aged 42) and Steffi Graf (now aged 39) won the singles in the tennis at Wimbledon. It was 3 years before the announcement of Linux (25th August 1991) and 6 years before the very first website was created (7th October 1994). So both languages have a long pedigree.

Perl v PythonFor compatability reasons, programming languages cannot change much over the years - you have to maintain the ability to run older programs - which is why so many languages have come along, become popular, and then faded away. In Perl's case, it's eclectic "many ways of doing anything" approach has lead to the addition of lots of other facilities along the way - most recently things like the say function in Perl 5.10 and even more ways of doing the same thing - something to be sorted out by the new Perl 6 grammar which will allow Larry Wall and his team to clear out a lot of dead wood from the syntax used by new programmers, but at the same time will allow the ongoing support of the Perl 5 grammar for established code. Python grew in use much more slowly - see the graph - because it was in many ways hugely ahead of its time. I'll say why in the next paragraph. That meant that there weren't a huge number of features added 10 and more years ago which are now an embarrassment, and that's doubly true because of Python's "let's not provide too many ways" philosophy. Python IS headed for "Python 3000" but do not expect it to be the huge change that Perl 6 is - it simply doesn't need that sort of overhaul! And you'll see on my graph I have given two ways forward for Perl depending largely on how well Perl 6 does and how soon it comes along - but I've only given one way for Python and that's up.

Why, then, did Python take of slowly? In part because it's an "Object Oriented" scripting language [Today's article is not the place to sidetrack onto OO!] that burst (or perhaps just bubbled) into a world where scripting was structured coding if you were lucky. People weren't ready for it! In the case of Perl, it didn't start of as being an OO language - the OO features and capability were added in 1992 and to some extent had to be fashioned around the language as it then existed. But having said that, the OO model is very flexible. Result of all of this? You can write good code for medium sized to large projects in Perl, but you will - almost automatically - be pushed towards good coding if you use Python.

What conclusions can we draw?

1. It is far easier to maintain programming standards into the future in Python than it is in Perl - Perl provides lots of ways of doing things which means that you need a very strong and technical managegial setup to provide a framework in which to work if you're doing a lot of long term coding.

2. Thoroughly experienced programmers can develop and maintain quicker in Perl than in Python but the learning curve is a much longer one, and for most people the pendulum will swing towards Python (it certainly does for the customer who gave me the inspiration to write this article today).

Here's a view of a customer of ours, a great fan of the Python language who works for a company that's a "Perl shop". See how he confirms my statements ;-)
"Secretly, I do like Perl but I 'think' in Python, and hate the non-maintainability that I see in Perl programs of just a few hundred lines of code. I think Perl users have a style for one-liners that doesn't scale to larger Perl programs. People need to write larger Perl programs with maintenance in mind." - Donald McCarthy

Oh - I will ONLY run training courses in languages that I like, and for customers who I feel that the language they're learning is an excellent solution. And we provide both Perl Courses and Python Courses. My recommendation today was towards Python - "even though" that will cost me £500.00 per delegate in lower fees as the Python course is shorter [not so many alternatives and complexities to learn!] - but I would rather earn less or even loose a prospective customer completely than I would lead someone up a garden path!
(written 2008-07-23)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A401 - Web Application Deployment - Structured Code and Object Orientation
  [3085] Object Oriented Programming for Structured Programmers - conversion training - (2010-12-14)
  [343] Should I use structured or object oriented? - (2005-06-10)

G908 - Well House Consultants - Language Comparisons
  [3785] Programming languages - what are the differences between them? - (2012-06-27)
  [3169] Rekeying a table - comparison in #Ruby #Perl and #Python - (2011-02-14)
  [3112] Public and private courses - subjects available for 2011 - (2010-12-29)
  [3003] What will we be teaching in six years? - (2010-10-17)
  [2947] Teaching Lua to a Perl advocate - (2010-09-06)
  [2866] Ruby - how does it compare and where is it the right language? - (2010-07-11)
  [2755] Books in the store in the USA - still a portent of the UK market to come? - (2010-05-08)
  [2700] The same very simple program in many different programming languages - (2010-03-31)
  [1990] Speaking all the languages - (2009-01-12)
  [1582] Ruby, C, Java and more - getting out of loops - (2008-03-19)
  [209] FAQ - Perl or PHP - (2005-02-11)

H101 - Introduction to PHP
  [4621] The power of scripting - (2016-01-12)
  [4118] We not only teach PHP and Python - we teach good PHP and Python Practice! - (2013-06-18)
  [3025] Learning to Program ... in PHP. Course examples. - (2010-11-01)
  [2097] PHP Course - for hobby / club / charity users. - (2009-03-22)
  [1958] PHP - Parse error: syntax error, unexpected $end ... - (2008-12-23)
  [1753] Perl v PHP, choosing the right language - (2008-08-14)
  [1198] From Web to Web 2 - (2007-05-21)
  [1050] The HTML++ Metalanguage - (2007-01-22)
  [949] Sludge off the mountain, and Python and PHP - (2006-11-27)
  [924] The LAMP Cookbook - Linux, Apache, MySQL, PHP / Perl - (2006-11-13)
  [917] Syntax checking in PHP - (2006-11-07)
  [846] Is Perl being replaced by PHP and Python? - (2006-08-27)
  [795] Remember a site's non-technical issues too - (2006-07-07)
  [789] Hot answers in PHP - (2006-07-02)
  [712] Why reinvent the wheel - (2006-05-06)
  [691] Testing you Perl / PHP / MySQL / Tcl knowledge - (2006-04-19)
  [646] PHP - London course, Melksham Course, Evening course - (2006-03-14)
  [629] Choosing the right language - (2006-03-01)
  [624] It's REALLY easy to add a little PHP - (2006-02-26)
  [577] Learning to program in Perl or PHP - (2006-01-26)
  [433] FTP - how to make the right transfers - (2005-09-01)
  [382] Central London Courses - Perl, PHP, Python, Tcl, MySQL - (2005-07-18)
  [380] Bridging to the customer requirement - (2005-07-16)
  [341] Happy Birthday, PHP - (2005-06-09)
  [317] Programming languages - a comparison - (2005-05-20)
  [135] Too many Perls - (2004-11-30)
  [132] Portrait of the author - (2004-11-27)
  [124] PHP v Java - (2004-11-20)
  [93] Case Sensitive? - (2004-10-19)
  [55] Evening classes to learn PHP - (2004-09-19)
  [48] PHP - onwards and upwards - (2004-09-14)

P201 - Perl - Introduction
  [2832] Are you learning Perl? Some more examples for you! - (2010-06-27)
  [2812] What is Perl? - (2010-06-15)
  [2070] Converting to Perl - the sort of programs you will write - (2009-03-08)
  [1852] Perl and Blackberries - (2008-10-23)
  [743] How to debug a Perl program - (2006-06-04)
  [604] Perl - multiprocess applications - (2006-02-13)
  [594] Twice is a co-incidence and three times is a pattern - (2006-02-07)
  [25] Release numbers - (2004-08-23)

Back to
Larger applications in PHP
Previous and next
Horse's mouth home
Forward to
Increasing Java Virtual Machine memory for Tomcat
Some other Articles
Perl 6 - When will we have a production release?
Some Ruby lesser used functions
A special day - last Friday in July
Increasing Java Virtual Machine memory for Tomcat
Q - Should I use Perl or Python?
Larger applications in PHP
Pictures from South Hampshire
Hillier Gardens, Hampshire
Ways to accept credit cards - or not!
As different as night and tyres
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1717_Q-S ... thon-.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat