views:

724

answers:

8

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!

+2  A: 

Download the book from here.Read it,breathe it and eat it.. :)
it's good for anyone.
http://diveintopython.org/

And updated for Python3

http://www.diveintopython3.org/

Srinivas Reddy Thatiparthy
I second the Dive Into Python. Its like the bible of Python starter books.
jellyfishtree
Should not the standard tutorial come first? Btw, Google App engine implies Python 2.5, right?
Hamish Grubijan
This seems like it has some references to Perl, although most of comparesons appear to be to Visual Basic...
DVK
@jellyfishtree - I don't necessarily need a volumnous starter book. E.g. I don't need explaining what lists are (or more to the point what map()) is on 3 pages. I just need to know how Python's map() differs from Perl's in 1 short paragraph.
DVK
@DVK Nobody writes books that way.Authors are paid for the pages,it's our job to sift through.I am yet to see a book which comapares perl and python feature by feature.
Srinivas Reddy Thatiparthy
DIP is out of date (or not yet in date, depending on the version) and full of inaccuracies and awful code.
Mike Graham
A: 

I wouldn't try to compare Perl and Python too much in order to learn Python, especially since you have working knowledge of other languages. If you are unfamiliar with OOP/Functional programming aspects and just looking to work procedurally like in Perl, start learning the Python language constructs / syntax and then do a couple examples. if you are making a switch to OO or functional style paradigms, I would read up on OO fundamentals first, then start on Python syntax and examples...so you have a sort of mental blueprint of how things can be constructed before you start working with the actual materials. this is just my humble opinion however..

jellyfishtree
Psst. Modern Perl developers use OO just as much as anyone else. And, as usual, TMTOWTDI. ;)
Robert P
@jellyfishtree - i'll try to not be offended, but really, that assumption was a bit uncalled for. I write fully OO code in Perl (as well as C++) - I did say I was an experienced Perl developer, not a script monkey - in addition I can do functional programming although with far less experience/quality :)
DVK
Perl and Python OO systems are very similar - Perl's one was copied from Python.
Alexandr Ciornii
Robert P: Not modern too - OO appeared in Perl long ago.
Alexandr Ciornii
ahh, snap..i forgot. Perl packages right? no offense intended, just so used to people using it for procedural scripts I forgot about the possibility. _| ̄|○
jellyfishtree
+1  A: 

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.

Mike Graham
+1  A: 

If what you are looking at is succinct, concise reference to python then the book Python Essential Reference might be helpful.

sateesh
+20  A: 

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

  • Spend a few hours going through all the basics. I found the official tutorial quite good, if a little dry.
  • A good reference book to look up basic stuff ("how do I get the length of a string again?"). The one I've found most useful is the Python Essential Reference.
  • Take a look at this handy Perl<->Python phrasebook (common tasks, side by side, in both languages).
  • A reference for the Python approach to "common tasks". I use the Python Cookbook.
  • An ipython terminal open at all times to test syntax, introspect object methods etc.
  • Get easy-install (to install Python modules easily).
  • Learn about unit tests fast. This is because without 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.
  • Check out Python questions on Stack Overflow. In particular, Python - Things one MUST avoid and Python 2.x gotcha’s and landmines are well worth a read.

Personally, I found Dive Into Python annoying and patronising, but it's freely available online, so you can form your own judgment on that.

ire_and_curses
Thanks a lot. I'm in the same boat.
FM
Excellent! Covers every bullet point I was going to ever ask! Thanks!!!
DVK
+1  A: 

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"

ghostdog74
A: 

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.

larley
+1  A: 

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.

Philip Durbin