Python for a Perl programmer

后端 未结 7 1457
时光取名叫无心
时光取名叫无心 2020-12-22 17:01

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 Sch

7条回答
  •  时光说笑
    2020-12-22 18:00

    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 ones I've found most useful are the Python Pocket Reference and 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 pip and 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.

提交回复
热议问题