turncoat

Steve Mynott steve at tightrope.demon.co.uk
Wed Aug 22 17:26:53 BST 2007


On Wed, Aug 22, 2007 at 03:07:09PM +0100, Peter Corlett typed:

> On 22 Aug 2007, at 13:20, Steve Mynott wrote:
> [...]
> >Also it takes no more than an hour or two for a Perl programmer
> >to become highly productive in Python.
> 
> Umm, bollocks. It'll take longer than that to overcome the culture  
> shock.
> 
> You and your editor have to get over the significant whitespace, then  
> you have to grip the basics of the language, then there's the  
> inhalation of the first few chapters of the library documentation to  
> get a feel for the capabilities of the basic datatypes.

I think you overstate the complexity of learning Python which
is designed to be learnt and based on a teaching language (ABC).

The syntax is much as you would expect from any vaguely C like, OO high level
language.  There are a few minor expections like the "for" loop using "range".
But I found these more interesting rather than annoying and it's nice to see
a different perspective on this sort of thing for a change.

I just installed "python-mode.el" for the whitespace.  The significant
whitespace is usually mentioned as a barrier but I quickly started to
like it.  You don't have to type braces or semi-colons which is 
quite true to the spirit of Perl in being lazy.

http://docs.python.org/lib/lib.html

is a good quick start for the standard libraries (which are much as you would
expect from any modernish high level open source language).  You
just have to watch for which libraries are deprecated or not.

For third party libraries use the Cheese Shop using "egg files" and
"easy_install".  Many are crap and some are really good (Twisted, Beautiful
Soup etc.).

The easiest way of learning it is by reading and writing it -- read
examples in the system python library directories and to try porting
some Perl or whatever.

> I've been poking at Python on and off for a while and I'd hardly  
> consider myself skilled at it. I still occasionally need to go and  
> look back at those first few chapters to remind myself the equivalent  
> of, say, "unshift". (It is to the language's credit that I find I  
> don't actually need to do such low-level list operations terribly  
> often which is why they're not yet committed to memory.)

A Rosetta Stone type cheat sheet helps with language equivalents.

Maybe

<http://merd.sourceforge.net/pixel/language-study/syntax-across-languages.html#BagAndLst>

is overkill ;-)

but

<http://wiki.python.org/moin/PerlPhrasebook>

is clear enough

I wasn't claiming it only took an hour or two to become a skilled
Python programmer but that most programmers should be able to write
non-trival, useful scripts in it after that time.  Its probably got
a shallower learning curve than most languages.

I'm sure there are hidden traps in the language which are known only by
experienced Python programmers, but my feeling is there are probably fewer
than with most languages and experienced programmers in any language can deal
with them (perhaps most quickly by IRC/mailing list/google cheating!).

-- 
Steve Mynott <steve at tightrope.demon.co.uk>


More information about the london.pm mailing list