MCslp HomeMCslp Home Contact | About | Help | Legal
Books | Articles | Downloads
News | News Archive
 
 
 
Perl to Python Migration

As a long time Perl and Python programmer, I'm constantly finding myself using Perl constructs in Python or Python constructs in Perl. Worse, I can suddenly find myself trying to use a feature or system in a Python program that just doesn't exist, or does and works differently. What I needed was some sort of cross reference.

After talking to other programmers and developers it became apparent that a number of people were 'jumping ship' from Perl to Python. Some with varying levels of success. The reasons for using Python in preference to Perl were different for each person, but there were some common themes:

  • Python is object-oriented. Although Perl has object orientation facilities they are not integrated into the system. In Python everything is an object or class - even the base data types are objects and have their own methods and attributes. This makes Python a great language to use in situations where you are working on applications that use object orientation as a core technology.
  • Python is easy to use. Python has a very clean and structured layout, and it's very easy to follow what's going on. Perl can frequently look like line noise, and particularly for new programmers this becomes a problem as they try to understand why their program works.
  • Python does what you tell it to. Perl suffers from a severe case of semi-intelligence. Statements and expressions in Perl have all sorts of rules, exceptions to those rules, and other artefacts that can make it difficult to follow what is going on. Just think about what happens when you call a function, was it called in list or scalar context?, what arguments did it have?, how do I get them back? These are regular questions when programming with Perl.
  • Python is cross-platform compatible. Perl is also cross-platform compatible, for certain values of compatible. Because of Perl's Unix roots it is very much a Unix language - use Perl under Windows or MacOS and a large proportion of the built-in functions become obsolete. Python's functionality is supported by external modules, many of which use the correct version according to their platform whilst retaining the same API.
  • These aren't really hard and fast reasons for why you should make the jump to Python, but they are compelling reasons for why Python is at least worth a look.

    In this book that's exactly what we try to do - show you how you can make the move from Perl to Python. Many of the basics are the same, and despite a change of language, you're unlikely to need to change the algorithms you are already using.

    For the more advanced programmer, or, like me, the programmer who has to use both languages most days, the book should also work as a handy cross reference to allow you to look up Perl and Python statements and functions and find out what you should use in both languages.

    Who Is the Book For?

    Anybody who has used Perl and who wants or needs to learn Python will find this book useful. The book gives a full guide on the basics of programming in Python from the perspective of a Perl programmer. Right from the basics of line and program structure all the way up to object-orientation and using external modules.

    You don't need to be an expert Perl programmer , you just need to be able to understand the basics. I've tried to make the text as easy to read and follow as possible. However, on occasion things get technical, and to get the best out of the book you should at least know how to use and create your own functions, extension modules and classes and objects.

    Without trying to give you the plot before you've read the book, if you know how to work with references, classes and objects in Perl, then your migration to Python is already 50% there!

    [an error occurred while processing this directive]
     P2PY Quick Links
     

    Book Summary
    Book Contents
    Book Errata
    Add a new errata entry

     Buy Perl to Python Migration
     

    Perl to Python Migration
    Amazon US | Amazon UK
    fatbrain (US)
    Learn how to move from programming in Perl through to Python
    Leverage your existing skills in Python as you did in Perl
    Cross reference guide to Perl/Python functions and modules


    Check the details on the Perl to Python Migration book!


    Website (c) 1998 and beyond Martin C Brown, MCSLP, UK. All other items, including contributed texts, files and information is the copyright of their respective owners.
    Contact Us