Moving from Perl to Python

Harry George hgg9140 at seanet.com
Sat Sep 25 19:59:02 EDT 1999


> On Fri, Sep 24, 1999 at 04:06:49PM +0200, Thomas Weholt wrote:
[snip]
> 
> > I got almost every book available on Perl published by O`reilly and one
> > of them, The Perl Cookbook, stands out as the most helpful. I was
> > wondering if there  were any other book or document online available for
> > Python? It has the structure of a simple question or desription of a
> > common task and code examples + explanation on how to solve it. 
> > 
[snip]
> 
> > Another thing that could help was if there was a document describing how
> > to migrate from Perl to Python, with examples. 
> > 

I also have the perl books and like cookbook.  I'm in the process of
converting a suite of perl modules to python.  Partly to learn python,
but mainly to get more maintainability at the package grows in
complexity.  Auto-conversion looked pretty hopeless, so I just open
two buffers in emacs.  Read the perl in one and type python in the
other.  Key insights:

1. Get python-mode.el installed.  It makes python formatting trivial.

2. Work out the regular expression tricks early -- I'm currently
   looking for a python idiom for 
      s/@@([a-z]+)@@/$lookup{$1}/g

Python needs a Cookbook.  Except for copyright issues, I'd say just
redo all the Perl Cookbook examples in python -- or maybe O'Rielly has
one in the works already.

-- 
Harry George
hgg9140 at seanet.com




More information about the Python-list mailing list