I am an experienced Perl developer with some degree of experience and/or familiarity with other languages (working experience with C/C++, school experience with Java and Scheme, and passing familiarity with many others).
I might need to get some web work done in Python (most immediately, related to Google App Engine). As such, I'd like to ask SO overmind for good references on how to best learn Python for someone who's coming from Perl background (e.g. the emphasis would be on differences between the two and how to translate perl idiomatics into Python idiomatics, as opposed to generic Python references). Something also centered on Web development is even better. I'll take anything - articles, tutorials, books, sample apps?
Thanks!
Perl code is not very simple as compared to code written in Python. Python code is simpler and easier to understand. Perl has an impressive support of libraries and so can handle Operations at OS level using built-in functions. Python needs the support of third-party libraries to handle such operations.
It is one of the oldest programming languages, but it is still one of the top-paying technologies. One might think that Perl is dead already, and there is no point in learning Perl, but if you have some Perl experience, you will still be in demand. Therefore, this programming language is worth learning in 2022.
Perl is known for its powerful regex and string comparison operations as it is influenced by sed and awk like powerful UNIX tools. In the case of regex and string operations like substitution, matching, replacement, Perl outperforms python which would take a few lines of code to achieve the same.
Python was never intended to replace Perl. Perl was designed to extract stuff from text files. Python was designed as a scripting language for system programming.
I've recently had to make a similar transition for work reasons, and it's been pretty painful. For better or worse, Python has a very different philosophy and way of working than Perl, and getting used to that can be frustrating. The things I've found most useful have been
use strict
you will feel crippled, and you will make many elementary mistakes which will appear as runtime errors. I recommend nose rather than the unittest framework that comes with the core install. unittest is very verbose if you're used to Test::More.Personally, I found Dive Into Python annoying and patronising, but it's freely available online, so you can form your own judgment on that.
If you happen to be a fan of The Perl Cookbook, you might be interested in checking out PLEAC, the Programming Language Examples Alike Cookbook, specifically the section that shows the Perl Cookbook code translated into Python.
Being a hardcore Perl programmer, all I can say is DO NOT BUY O'Reilly's "Learning Python". It is nowhere NEAR as good as "Learning Perl", and there's no equivalent I know of to Larry Wall's "Programming Perl", which is simply unbeatable.
I've had the most success taking past Perl programs and translating them into Python, trying to make use of as many new techniques as possible.
Check out the official tutorial, which is actually pretty good. If you are interested in web development you should be ready at that point to jump right in to the documentation of the web framework you will be working with; Python has many to choose from, with zope, cherrypy, pylons, and werkzeug all having good reputations.
I would not try to search for things specifically meant to help you transition from Perl, which are not to be of as high of quality as references that can be useful for more people.
This is the site you should really go to. There's a section called Getting Started which you should take a look. There are also recommendations on books. On top of that, you might also be interested in this on "idioms"
If what you are looking at is succinct, concise reference to python then the book Python Essential Reference might be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With