Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Beginning Python: From Novice to Professional

Posted by samzenpus on Wed Jan 11, 2006 02:24 PM
from the from-start-to-finish dept.
nazarijo writes "Python seems to be devouring everything these days, with more and more people using it for serious projects. It's quickly supplanting Perl in some circles, and with good reason. It's a powerful, richly featured language with boatloads of extensions. And, unlike Perl, it's very easy to do complicated things in simple, legible code. Python books are still only a small part of the shelf at your local bookstore when you compare it to the popularity of Perl, but which ones are the gems and which ones are fluff? Having looked at a lot of Python books in the past couple of years, I think that Beginning Python: From Novice to Professional is the one that I'll most recommend to people." Read on for the rest of Jose's review.
Beginning Python: From Novice to Professional
author Magnus Lie Hetland
pages 604
publisher Apress
rating 8/10
reviewer Jose Nazario
ISBN 159059519X
summary Tour the Python language, from basics to advanced modules


Beginning Python is loosely grouped into three main sections. The first deals with Python fundamentals, all the goodies that are inherent to the language and the modules that it ships with. It's surprising to see how rich the language is out of the box, especially when compared to some other scripting languages. The second section would be the chapters covering popular extensions for a variety of services. These include network and web programming, SQL objects, and even GUI programming. And finally the third section is a set of 10 projects in Python, which bring everything together in a concise fashion.

I like this book a lot because it is very clear in its delivery, both the prose and the code examples used, and is consistently Pythonic. The Python language lends itself to a powerful programming style and, unlike Perl, many Python developers I know don't bother with a dozen ways to perform a simple action, they get it done and move on. What you wind up with is clear code that's easily understood by someone new to the language.

Unlike what the title would suggest, Beginning Python isn't only for the first few weeks with the language. The book is large and in depth, and the coverage of material is fantastic in many ways. You get a quick tour of the basics and then you move on to an overview of the language and then its common features. The inclusion of the 10 projects is another benefit to the intermediate user. She can refer back to this book for additional information and pointers from time to time, it wont sit still on her shelf.

That said, there are a few things in the book that I tend to disagree with. For example, the author dissuades you from using destructors in your code, but in my experience they're far more reliable, and a better place to do some cleanup, than he states. A few chapters are also a bit skimpy when they didn't need to be. For example, Chapter 18, which covers packagers like the distutils component from Python, needed to be fleshed out a lot more. This is a powerful feature in Python and sound docs on it should just be there. There's no reason to hold back on something so vital. The section on profiling in Chapter 16 is also a bit thin around the middle when it needn't be. While this seems like a minor point, having a reference to speeding up code (and measuring the improvements) is always nice. And finally, Chapter 17, which covers extending Python, is simply too short for its own good. A more in depth example would have been appreciated.

I have begun recommending this book to people I know that are smart and program in other languages, but aren't very familiar with Python. Many beginners books only take a person so far before they become a useless item on the shelf. This means that he $30 or more that was spent is now gone, so I've grown to be observant of how long I expect a book to be useful. I anticipate the useful shelf life of Beginning Python will be longer than average for most general purpose programming books for a single language. What's more is that it's not a dry reference book. Couple this to a Python cookbook for recipes and you have a two volume "mastering Python" series.

If you've been curious to learn Python and haven't yet found the book that speaks to you clearly, this may be the one. I'm pleased with the quality of the writing, the examples, and the quick pace of the book. While it's nearly 30 chapters in length, most of them are short and focused, making them easily digestible and highly useful. Overall probably the best Python books I've had the good fortune of reading."


You can purchase Beginning Python: From Novice to Professional from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • free python tutorial from book author (Score:5, Informative)

    by chriss (26574) * <chriss@memomo.net> on Wednesday January 11 2006, @02:26PM (#14447907)
    (http://memomo.net/)

    Not only is this a good book, it is also one of only few that cover Python 2.4. The author Magnus Lie Hetland has a free python tutorial ("minimal crash course) (Instant python [hetland.org]) on his homepage. He was also involved (as author, editor etc.) in several other book projects:

    So we can assume he has a clue what he is writing about.

    His homepage [hetland.org] uses PHP, btw.

    Chriss

    --
    memomo.net - brush up your German, French, Spanish or Italian - online and free [memomo.net]

  • being python (Score:2, Funny)

    by joe 155 (937621) on Wednesday January 11 2006, @02:27PM (#14447911)
    (Last Journal: Wednesday September 20 2006, @10:30AM)
    we are the knights who say Ni!
    Oh, sorry, wrong python
  • Totally fresh in programming (Score:5, Interesting)

    by Nichotin (794369) on Wednesday January 11 2006, @02:30PM (#14447934)
    I hope this is not modded off topic. Here goes:

    I am probably not the smartest person in the world, and I have no programming experience what so ever. What I am looking for, is some easy language to either script or program. Would python provide a good starting environment? Have any of you been at my level, then learned python?
    I have tried to do as much research as possible myself, but it seems that everyone I ask just woke up one morning, and found themselves to be able to program three or more languages (in other words, they do not remember how they started out). I have also tried to learn several languages by reading some O'Reilly books and similar, but I have been put off by the seemingly academic english that is used (my native language is norwegian, by the way).

    If anyone have any recommendation, as tho where to start, I would be more than happy.
  • Devouring? (Score:5, Informative)

    by MosesJones (55544) on Wednesday January 11 2006, @02:31PM (#14447945)
    (http://service-architecture.blogspot.com/)
    Python seems to be devouring everything these days... even replacing Perl

    From Dice.com

    Python : 545 matches
    Perl: 3809
    C#: 3850

    Ummm over 1/8 of the demand of Perl or C#

    Java: 11856

    Java+BEA: 621

    So Python is smaller than one specific application servers development requirements.

    Python is better than Perl, but in terms of devouring? Its like saying that American Football is devouring other sports around the world.

    • Re:Devouring? (Score:4, Insightful)

      by GigsVT (208848) * on Wednesday January 11 2006, @02:36PM (#14447989)
      (Last Journal: Saturday June 30, @01:22AM)
      That's not a good measurement.

      Those are unfilled jobs. Jobs that they couldn't find someone for without resorting to advertising. In other words, the jobs that get listed on job sites are the ones that no one wants.
      [ Parent ]
      • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @04:53PM
        • Re:Devouring? by GigsVT (Score:1) Thursday January 12 2006, @09:45AM
      • Re:Devouring? by Breakfast Pants (Score:2) Wednesday January 11 2006, @06:11PM
      • Re:Devouring? by mooingyak (Score:2) Wednesday January 11 2006, @06:25PM
    • Re:Devouring? by blackmonday (Score:2) Wednesday January 11 2006, @02:41PM
      • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @03:40PM
        • Re:Devouring? by belmolis (Score:3) Wednesday January 11 2006, @04:34PM
          • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @04:45PM
            • Re:Devouring? by saltydogdesign (Score:1) Wednesday January 11 2006, @04:49PM
            • Re:Devouring? by belmolis (Score:2) Wednesday January 11 2006, @04:50PM
              • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @04:57PM
    • Re:Devouring? by Anonymous Coward (Score:1) Wednesday January 11 2006, @02:42PM
      • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @03:46PM
    • Re:Devouring? (Score:5, Interesting)

      Just to make another useless-but-interesting experiment, I tried the following: Google for:
      "written in python": 665,000 hits
      "written in perl": 1,140,000 hits
      "written in c": 1,500,000 hits
      "written in c++": 772,000 hits
      "written in c#": 342,000 hits
      "written in java": 1,750,000 hits
      "written in haskell": 33,600 hits
      "written in lisp": 61,400 hits
      "written in pascal": 51,800 hits
      "written in objective c": 26,800 hits
      "written in ruby": 120,000 hits

      I'm not sure what this measures, but it's interesting. :) Python actually did a lot better than I expected.

      [ Parent ]
    • Re:Devouring? (Score:5, Insightful)

      by Decaff (42676) on Wednesday January 11 2006, @03:55PM (#14448745)
      Python is better than Perl, but in terms of devouring? Its like saying that American Football is devouring other sports around the world.

      You are forgetting that this is the Slashdot Universe, where...

      "Java/Intel/Oracle/Sun/Windows is dying..."

      "No-one uses commercial UNIX..."

      "Open Source is GPL and anything else is evil.."

      "PHP scales for everything...."

      and...

      "Favourite open-source language [fill in the blank] is the future and everyone is already using it...."

      When in this Slashdot dimension, you have to understand the rules!
      [ Parent ]
      • Re:Devouring? by Russ Nelson (Score:2) Wednesday January 11 2006, @04:37PM
      • Re:Devouring? by Britz (Score:2) Wednesday January 11 2006, @07:35PM
        • Re:Devouring? by Decaff (Score:2) Wednesday January 11 2006, @08:20PM
          • Re:Devouring? by Chapter80 (Score:1) Thursday January 12 2006, @04:08AM
    • Re:Devouring? by smallpaul (Score:3) Wednesday January 11 2006, @04:04PM
    • Re:Devouring? by Klaruz (Score:2) Wednesday January 11 2006, @06:43PM
    • 2 replies beneath your current threshold.
  • On a related note... (Score:3, Informative)

    by Just Some Guy (3352) <kirk+slashdot@strauser.com> on Wednesday January 11 2006, @02:32PM (#14447947)
    (http://honeypot.net/ | Last Journal: Friday April 07 2006, @09:33AM)
    For a quicker introduction to the language, you might look at the article I wrote [freesoftwaremagazine.com] for Free Software Magazine [freesoftwaremagazine.com]. It's not an in-depth analysis by any means, but should get you acquainted with the basics in under 10 minutes.

    It's licensed under the Creative Commons "Attribution-Share-alike" License, so feel free to pass it around if you want to.

  • by Wisgary (799898) on Wednesday January 11 2006, @02:33PM (#14447965)
    I was at borders yesterday and I saw maybe 500 books from O'Reilly, 500 more from thompson and 1,000 more from random publishers, please for the love of god someone help me out and name me some *good* python books for an intermediate programmer. Most of my experience is in C++ and I would like to learn a high level language like Python, so please name me some books and help me in this impossible quest at borders.
  • O, yeah? (Score:3, Insightful)

    by Anonymous Coward on Wednesday January 11 2006, @02:35PM (#14447975)
    "And, unlike Perl, it's very easy to do complicated things in simple, legible code."

    Perhaps it is time for you to get a perl book or take CS-101 course or something.
    • Re:O, yeah? (Score:5, Insightful)

      by Just Some Guy (3352) <kirk+slashdot@strauser.com> on Wednesday January 11 2006, @03:16PM (#14448388)
      (http://honeypot.net/ | Last Journal: Friday April 07 2006, @09:33AM)
      "And, unlike Perl, it's very easy to do complicated things in simple, legible code."

      Perhaps it is time for you to get a perl book or take CS-101 course or something.

      I've got both. So, tell me: what's the syntax for returning multiple complex objects from a function in such a way that they don't have to be dereferenced by the calling code (that is, they can be used directly, just like you were returning a single scalar)?

      Python example from the interactive shell:

      >>> def foo():
      . return {'one': 'ein', 'two': 'zwei'}, lambda x: x + 5, str
      >>> a, b, c = foo()
      >>> a['two']
      'zwei'
      >>> b(5)
      10
      >>> print c.__doc__
      str(object) -> string

      Return a nice string representation of the object.
      If the argument is a string, the return value is the same object.

      I'm not overly stupid, but doing something so relatively easy in Perl put me at my limits. I like Perl, and I've written many large programs in it, but I always had to fight against the syntax. Python got out of the way and let me concentrate on logic instead.

      [ Parent ]
      • Re:O, yeah? (Score:5, Insightful)

        by Parity (12797) on Wednesday January 11 2006, @03:43PM (#14448622)
        That's a really foolish argument. Of course you have to make references and dereference to do the same thing in perl, because perl is a pass by value language; python is a pass by reference language.

        In perl you have to be explicit to dereference.

        In python you have to be explicit to copy.

        Your case happens to be one where references are needed, and in python, implicit. In cases where copying of arrays is need, python needs to be explicit; perl is implicit. So ignoring the ridiculous 'without dereferencing' restriction:

        sub foo {
          return { 'one' => 'ein', 'two' => 'zwei' }, sub { my $x = shift; return $x + 5; }, "string"
        }

        my ($a, $b, $c) = foo();

        print $a->{'one'};
        print $b->(5);
        print $c;

        [ Parent ]
        • Re:O, yeah? by Just Some Guy (Score:2) Wednesday January 11 2006, @04:02PM
          • Re:O, yeah? by Parity (Score:2) Wednesday January 11 2006, @05:11PM
      • 1 reply beneath your current threshold.
    • Re:O, yeah? by Coryoth (Score:3) Wednesday January 11 2006, @03:27PM
    • Re:O, yeah? by m50d (Score:2) Wednesday January 11 2006, @04:21PM
    • yeah! OO stinks in perl by McKing (Score:2) Wednesday January 11 2006, @04:52PM
    • Re:O, yeah? by KDR_11k (Score:1) Wednesday January 11 2006, @03:10PM
      • 1 reply beneath your current threshold.
    • 1 reply beneath your current threshold.
  • Has to bash on Perl (Score:2, Insightful)

    by Anonymous Coward on Wednesday January 11 2006, @02:42PM (#14448045)
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    This must mean you aren't able to write legible Perl code. Perl has been making complicated things simple for more than a decade. If you don't know how to write clean code, then your Python will also suck.

    • Re:Has to bash on Perl (Score:5, Insightful)

      by Myddrin (54596) on Wednesday January 11 2006, @02:57PM (#14448202)
      (http://www.myddrin.com/)

      And, unlike Perl, it's very easy to do complicated things in simple, legible code.

      This must mean you aren't able to write legible Perl code. Perl has been making complicated things simple for more than a decade. If you don't know how to write clean code, then your Python will also suck.

      Not directed at the parent, but at the Perl-snipping in the original post....

      <RANT>

      I'm a professional python programmer, and I've been making my living at it for a number of years now. (It was my embracing of python that allowed me to transition to a 100% MS free workspace.) I started using it a project a few years ago, and it's just stuck for a number of reasons. (meta-classes, extensibility, etc.)

      One thing that drives me buggy about some python evangelists, (and many evangelists, in general) is the need to bash anything that is not their favorite brand (be it Creative vs iPOD, Python vs (insert any language here). And so on. The fact of the matter is that Perl is a perfectly good language. I don't use it on a regular basis personally, but I've seen, read and understood a good deal of Perl code w/o a hassle. (yes, I've seen some scary code, but I've seen scary code in C++, Python, Java, etc., etc., etc.)

      Sometimes we just have to admit that there are multiple good tools that we could use, but we have a personal (and possibly irrational) preference for one over the other. That's life as a human being (which I'm assuming at least 99% of the readers out there are. :) ). Just because some people use Perl, doesn't make my choice of python (of C++, my other "main" language) any less valid.

      It's real life, not a multiple choice test -- there is no single "correct" answer.

      </RANT>

      Ok, I'm done... back to work.

      [ Parent ]
    • Re:Has to bash on Perl by jcarter (Score:1) Wednesday January 11 2006, @03:29PM
    • Re:Has to bash on Perl by bhaskin (Score:1) Wednesday January 11 2006, @06:03PM
  • My 2 scents (Score:2, Offtopic)

    by Cro Magnon (467622) on Wednesday January 11 2006, @02:47PM (#14448086)
    (http://slashdot.org/ | Last Journal: Monday October 04 2004, @03:55PM)
    I'm a total n00b in Python, but I like what I see. I'm planning to rewrite a Perl program I have in Python.

    My biggest gripe is that Python lacks a "use strict" to protect me from my own badd speling.
    • Re:My 2 scents by Anonymous Coward (Score:2) Wednesday January 11 2006, @03:22PM
      • Re:My 2 scents by Cro Magnon (Score:2) Wednesday January 11 2006, @03:35PM
        • 1 reply beneath your current threshold.
    • Re:My 2 scents by jonathansamuel (Score:1) Thursday January 12 2006, @04:09PM
      • Re:My 2 scents by Cro Magnon (Score:2) Thursday January 12 2006, @04:13PM
        • Re:My 2 scents by jonathansamuel (Score:1) Thursday January 12 2006, @07:02PM
  • by hashmap (613482) on Wednesday January 11 2006, @02:48PM (#14448104)

    EXTERIOR: DAGOBAH--DAY

    With Yoda strapped to his back, Luke climbs up one of the many thick vines that grow in the swamp until he reaches the Dagobah statistics lab. Panting heavily, he continues his exercises--grepping, installing new packages, logging in as root, and writing replacements for two-year-old shell scripts in Python.

    YODA: Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax... more than one way to do it... default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will.

    LUKE: Is Perl better than Python?

    YODA: No... no... no. Quicker, easier, more seductive.

    LUKE: But how will I know why Python is better than Perl?

    YODA: You will know. When your code you try to read six months from now.

  • Simple, Legible Code (Score:5, Insightful)

    by AthenianGadfly (798721) on Wednesday January 11 2006, @02:48PM (#14448108)

    And, unlike Perl, it's very easy to do complicated things in simple, legible code

    The issue with Perl isn't that it's particularly hard to do complicated things with simple, legible code (not more so than a lot of other languages, anyway), but that it's very, very easy to do something extremely quickly, which often - but not always - means code that makes sense at the time but isn't necessarily readable, or leads to overly terse code. Yes, Perl makes it easy to do things wrong (and a lot of people out there do use Perl to make unreadable programs), but that doesn't mean that it can't be used to do things correctly as well as any other language.

    • Re:Simple, Legible Code by lawpoop (Score:3) Wednesday January 11 2006, @03:20PM
      • Re:Simple, Legible Code by Red Flayer (Score:2) Wednesday January 11 2006, @03:58PM
      • Python is a straightjacket (Score:4, Insightful)

        by Tony (765) on Wednesday January 11 2006, @05:07PM (#14449395)
        (http://zoeshire.com/ | Last Journal: Thursday October 31 2002, @05:12PM)
        In Perl, it is easy to make legible code, and it is easy to make illegible code.

        In Python, it is easy to make legible code, but it is difficult to make illegible code.


        That's because Perl is versatile, flexible. Python forces you to do things The Python Way(tm). I've tried Python a couple of times, and I keep going back to Perl. Maybe I'm just a rebel, but I don't like a language telling *me* what to do (queue "In Soviet Russia..." joke here).

        And, yes, I mostly just hate the whitespace-as-blocking braindamage. It's like Guido loved LISP, but hated the braces, so he re-invented LISP, poorly. But that's why I love programming-- everybody gets to choose their favorite poison.
        [ Parent ]
    • Re:Simple, Legible Code by SCHecklerX (Score:2) Wednesday January 11 2006, @03:53PM
    • Re:Simple, Legible Code by michael_cain (Score:2) Wednesday January 11 2006, @04:00PM
    • Re:Simple, Legible Code by m50d (Score:2) Wednesday January 11 2006, @04:23PM
    • Re:Simple, Legible Code by archeopterix (Score:2) Thursday January 12 2006, @08:01AM
  • Dive into Python (Score:4, Informative)

    by Jazzer_Techie (800432) on Wednesday January 11 2006, @02:48PM (#14448110)
    No discussion of Python literature can be complete without mentioning Mark Pilgrim's Dive into Python [diveintopython.org], which is an excellent way to get to know the Python language. It's free for download in a variety of formats. Two caveats however, being that 1) it hasn't been updated in about a year and a half and 2) it assumes that you already have a pretty good grasp of programming in some other language. But if you've you got some coding experience and want to take a serious look at what Python has to offer, this is a great book full of nice examples (with the code available for download as well).
  • python regexes (Score:2, Insightful)

    by funkelectric (931604) on Wednesday January 11 2006, @02:48PM (#14448111)
    After hacking perl for over 10 years, Python sounds very good. The first program I tried to write in Python was the quick-and-dirty thing I need most: Read a file and parse it using regexes. Perhaps I stumbled upon the one area where Perl shines in comparison with Python, for that is the impression I got. The Python regex methods do not seem a natural fit for the problem.
  • by digitaldc (879047) * on Wednesday January 11 2006, @02:49PM (#14448125)
    "While it's nearly 30 chapters in length, most of them are short and focused, making them easily digestible and highly useful."

    It also goes well with a cup of Java, fried Kalamaris and a side of Perl pasta.
  • by chriss (26574) * <chriss@memomo.net> on Wednesday January 11 2006, @02:53PM (#14448170)
    (http://memomo.net/)

    Since this is inevitable to pop up, a very simplyfied version (slightly offtopic):

    Why not ditch Python and use Ruby (on Rails)?

    • Ruby is a nice language. It looks more like Java (or C or Perl) than Python, so that may be an advantage for those who dislike Pythons whitespace handling (I think it is genius)
    • Rails is a very nice framework for developing database driven web-apps very fast
    • Someone (David Heinemeier Hansson) really cared to make this user/developer friendly. There is good marketing, nice screencasts (although basically smoke and mirrors), good documentation, a well structured central web site, lots of support. All this may be even more important than the technical differences to other platforms like Python.
    • It's hype, so you could easily sell it to management

    Why better stick with Python?

    • Most of the hyped features Rails are available on Python too, although not yet in such a nice package. The Turbogears [turbogears.org] folks try this, but in a more pythoniac way. I like it better, since they actually bundled already established products like CherryPy and SQLObject instead of simply writing from scratch. This may not result in a smooth package like RoR, but it is more clearly aimed at the integration of other products.
    • There are tons of modules and documentation for Python out there. So if you come to the point where you want to include other features than those already present in your framework, it will be easier to add them from different sources, because a) there are more and b) integration is a more established process.
    • There has been a lot going on in the RoR aftershock to improve the situation, like discussions about merging the different frameworks (Turbogears/Subway) to create a unified and very powerful platform.
    • There is always a way up in Python with Zope (although this is a beast and documentation is bad, 3.X is much better, but lots of products currently still require 2.X) and integration in J2EE.
    • Python is old. There has not only been one generation of developers whos projects failed, but many. RoR is still in the "early adaptors" phase, where everyone sees the revolution and casualties are accepted. Ruby alone has had a strong following in Japan, but for the rest of the world Rails was the first contact. Wait a year until the "RoR sucks" postings appear, than you'll be much wiser.

    Chriss

    --
    memomo.net - brush up your German, French, Spanish or Italian - online and free [memomo.net]

  • by Timesprout (579035) on Wednesday January 11 2006, @03:04PM (#14448262)
    I like to play with Python occasionally but when I see something like

    hat said, there are a few things in the book that I tend to disagree with. For example, the author dissuades you from using destructors in your code, but in my experience they're far more reliable, and a better place to do some cleanup, than he states.

    I really have to wonder. Does someone have no idea what they are talking about or does a certain language have a very crappy garbage collector.

    Anyone care to offer some insights as to why the reviewer made this statement?
  • Perl vs. Python (Score:1, Redundant)

    by Randolpho (628485) on Wednesday January 11 2006, @03:04PM (#14448263)
    (http://www.google.com/ig | Last Journal: Wednesday April 11 2007, @09:55AM)
    Perl vs. Python flame war commencing in 5...... 4....... 3....... 2....... 1......
  • Dive Into Python? (Score:2)

    by bblazer (757395) * on Wednesday January 11 2006, @03:09PM (#14448326)
    (http://www.brianandkate.com/brianblog | Last Journal: Friday October 22 2004, @10:48PM)
    What about Dive Into Python by Mark Pilgrim? Like the title says, you dive right in. There is no "Hello World!" stuff to mung through. He uses real world examples right from the start, and explains them in a way that a 4 year old could understand.
  • Learning Python (Score:3, Informative)

    by kevin_conaway (585204) on Wednesday January 11 2006, @03:09PM (#14448327)
    (http://pyscrabble.sf.net/)
    I am a Java programmer by profession but I wanted to give Python a shot because it seemed like fun.

    As a programmer experienced with OO programming and some other types of "scripting" languages, all I needed to read was Learning Python [oreilly.com] from O'Reilly. Great book, great language.

    On a shameless side note, if you're a Scrabble fan, come check out my online, multiplayer Scrabble program written in Python. PyScrabble [sf.net]
  • A few good and free Python books (Score:4, Informative)

    by YA_Python_dev (885173) on Wednesday January 11 2006, @03:11PM (#14448344)
    (Last Journal: Thursday August 23, @11:40AM)
    On the python.org [python.org] site you can find a big list of Python books [python.org].

    I suggest:

    Good reading.

  • most helpful book (Score:2, Insightful)

    by engagebot (941678) on Wednesday January 11 2006, @03:11PM (#14448346)
    I think the book thats most helpful to the novice programmer wouldn't be a book about any language at all.

    It'd be a book about programming and algorithms in general. Its MUCH easier to root around in a 'hello world' program or the like if you understand things like loops, if/then/else statments, function calls, etc. Even the fundamental idea of declaring and using a variable.
  • -1 Troll for Submitter (Score:3, Insightful)

    by toupsie (88295) on Wednesday January 11 2006, @03:16PM (#14448393)
    (http://127.0.0.1/)
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    So can Perl.

  • by mrfoos (584110) on Wednesday January 11 2006, @03:17PM (#14448396)
    Comparing to two for me is like comparing tree cutting with building houses.

    When you build a house you need an architect and specific design rules so other people in the project can do their part. It takes a long time to build it, and someone has to live in the house a long time.

    When you cut down a tree you're only interested in the fastest way possible to get it down safely. Who cares if it's pretty. If you didn't like the way the first one fell, you can make adjustments on the next.

    A house builder wouldn't tell a woodcutter which axe to use. He doesn't care. Of course, woodcutters have no business building houses.

    Personally? I like being a lumberjack. Nothing like fervorishly hacking away and yelling "TIMBER!" from a safe distance.
  • by KDR_11k (778916) on Wednesday January 11 2006, @03:21PM (#14448431)
    Maybe I just missed the appropriate packages but to my knowledge Python lacks things like strict typing that are invaluable helpers when you want to make sure stuff works as it should. Nothing is more annoying than reading "int has no member function ______" and having to track down where that variable got its int contents from. After being introduced to Haskell in university strict typing just becomes something I really want in a language. There's just no real way to be sure all variables are the type you want when you're bug hunting and lack of access control for classes and their free extendability (being able to just add members to any instance of the class) are enemies of debuggable code as well.

    Pattern matching would be nice too but probably not feasible.
  • by WampagingWabbits (627551) on Wednesday January 11 2006, @03:22PM (#14448441)
    (http://www.mobilemaps.com/)
    Do I detect a trace of defensiveness in your tone? That you would like to think Python is gaining ground on Perl but you suspect it might not be? And you are confused as to why this is? Why don't Perl programmers leave their language in droves and convert to your favourite one? Why are slashdot, amazon, citysearch, ticketmaster, et al still using perl on their sites instead of Python for example?

    It could be that you misjudge Perl. Like judging a book by its cover, you have failed to see that Perl is perfectly capable of performing powerful tasks with simple, clean, easily maintained code. Perl is a practical language, and while dollar and percentage signs (and brackets) might not win a code beauty contest they provide useful information none the less.

    Perhaps while promoting Python's discipline over Perl's freedom of expression you have hit upon the reason for Python's failure?
  • I tried python (Score:2)

    by plopez (54068) on Wednesday January 11 2006, @03:22PM (#14448443)
    But I found it too constrictive.

    Right now Ruby is my new Perl.
    • Re:I tried python by Anonymous Coward (Score:1) Wednesday January 11 2006, @04:01PM
      • 1 reply beneath your current threshold.
  • Is Mr. Nazario writing about Python or Perl? I couldn't quite tell, because fully half the sentences in his summary text mention Perl.

    He writes the Python is "quickly supplanting Perl in some circles." That's an intriguing statement. But instead of explaining how great Python is in concrete terms (in either summary or review), Mr. Nazario seems content to simply rip on Perl with flamebait like

    unlike Perl, it's very easy to do complicated things in simple, legible code and

    unlike Perl, many Python developers I know don't bother with a dozen ways to perform a simple action, they get it done and move on

    This could leave a lot of people with the conclusion that Python mainly appeals to people with a chip on their shoulder about Perl, which does not serve the Python community well -- particularly when there are languages like Ruby that have evolved demonstrably superior ways of getting things done (compared to frameworks available for Perl OR Python).

  • Unlike Perl (Score:1)

    by scottsk (781208) on Wednesday January 11 2006, @03:28PM (#14448500)
    (http://www.scottmcmahan.net/)
    "Unlike Perl" -- why are they so defensive? If Perl loses, it'll go the way of FORTRAN into the museum. If Perl wins, there's still plenty of room for other programming languages. Perl hasn't exactly made REXX, Pike, PHP, LISP, etc extinct or anything. (Not trolling, but I think Python users are so defensive because Python is the first language I know of since COBOL to make the whitespace of indention a significant part of the syntax.)
  • by goarilla (908067) on Wednesday January 11 2006, @03:43PM (#14448624)
    Although i do not consider myself a programmer (yet)

    I used to fiddle around in the win 3.x area when i was (6-10) with qbasic copy-pasting
    those speaker sounds and alternating things in that and later alternating gorillas.bas
    I remember those days took me a lot of time to get brother jackob, frère jacques, broeder jacob to play on my pc speaker
    because we in belgium use the do-re-mi music scale instead of the C,D,...

    But that's beside the point i'm just pointing out although i had extensive experience when i was young with basic
    i left it on the kitchentable when win95/98 came out and truthfully i lost a lot of skill.
    Tried VB when i was 14 made some stupid programs to measure mathematical things of cubes, triangles, ...
    But the most fun and the biggest learning experience i had
    was when i tangled around with source: most things i learned was with gorillas.bas or the simple 2 player shoot game(vb)

    Now i'm actively making a lot of shell scripts and i'm very happy with that.
    The reason imho that i'm happy with it is probably because in a sense its programming and ... it's constantly in my head
    i use that shell daily, it doesn't see the kitchen at all so to speak.

    I want to program, you want to program but it takes time, effort and u can't let it stand on the table!
    for that and other reasons i think the best way is to: start shell scripting and then evolve to python and later c/c++
    i'm trying python and
    i'm very happy with it but it's my next on my very big todo-list there still are some things i need
    to learn in bash

    A huge advantage bash, any scripting language, python, basic have in common is that it can/must (be) interpreted
    so u don't have to compile and wait!

    it's almost instant trial and error and that helps the beginning programming experience as you can tangle with source and see the results very rapidly

    Or, as the following modern Zen poem has it:

    To follow the path:
    • look to the master,
    • follow the master,
    • walk with the master,
    • see through the master,
    • become the master.


    i got this from this site which is probably an interesting read for you
    http://www.catb.org/~esr/faqs/hacker-howto.html
    Anyway good luck
  • Wrox.... (Score:1)

    by In Fraudem Legis (937585) on Wednesday January 11 2006, @03:43PM (#14448634)
    Wrox has great books, including Beginning Python.
  • Python Riddles (Score:3, Interesting)

    by AlXtreme (223728) on Wednesday January 11 2006, @03:58PM (#14448768)
    (http://www.aperte.nl/ | Last Journal: Monday July 07 2003, @05:11AM)
    Recently came across pythonchallenge [pythonchallenge.com], it's a notpron/riddle site for learning Python, with each riddle requiring more and more code. Great idea, imho.

    As if python itself wasn't fun enough :)

  • by herve_masson (104332) on Wednesday January 11 2006, @04:00PM (#14448790)
    unlike Perl, it's very easy to do complicated things in simple, legible code.

    Not willing to start some useless python vs perl comparizon, your assertion is wrong: in perl, it is also easy to do complicated things in simple legible code. As someone who write and read perl code on a daily basis for about 5 years, I have the feeling that you should have written: "with perl, it is very easy to do complex things in obfuscated write-only code".
  • So a couple months ago I got really into python. I've programmed in both C++, a bit of perl, and LISP (as well as a hodgepodge of other languages) and was really attracted to the powerful combination of functional tools and object oriented design. I found generators, iterators and other advanced language features absolutely great and started to really like the language.

    As I got a bit more into the language I started finding myself continually frustrated. Despite the "we're all adults" attitude about privacy and object protection it seemed Guido (guy in charge of python language) repeatedly made deciscions telling me that I shouldn't use features like co-routines, continuations or other powerful features except in limited circumstances (generators). I've even heard rumors about removing map (or was it apply) from the language. It wasn't that these features couldn't be implemented (stackless python did it) or they wouldn't be usefull (see ruby's use of coroutines) but as best I could tell Guido didn't like these functional or otherwise non-sequential features. Overall this lack of general functionality just made the language feel sorta unfinished and frustrating.

    I've moved on to ruby since then which, while underneath is pretty different, seems to give me all the features of python plus those general features like co-routines and continuations.

    Anyway this post might be a little off topic but I was wondering if there was any valid reason not to involve these powerfull features other than just personal taste. I can understand if some programmers coming from a procedural background might find these features confusing or harm code readability but is there any other reason? I love these sort of additions and I just can't figure out why, despite clear interest (stackless python, several PEPs) they aren't included in python to make it feel 'complete'.

  • by aurelian (551052) on Wednesday January 11 2006, @05:31PM (#14449594)
    A lot of people have religious problems with the whitespace significance in python, but I object to it on practical grounds. It bugs me every time I'm constucting conditional clauses - i.e. all the time. Coupled with the lack of a block quote (like /* */ in C), it means that if I want to move lines of code in or out of a condition, I have to cut and paste several lines, and edit their indentation. For large condition clauses this can be a real pain. In most other scripting languages, e.g. ruby, I just have to move an 'end' statement, or perhaps just comment out the if and end lines.

    Don't get me wrong - I'm all for having consistent and rigorous indenting once the code is finalised. I'm just irritated by the fact that the indentation has to be correct at every stage of the code development, even when I'm just experimenting with ideas. I like to be able to leave things a little messy while working on it, and then clean it up before moving to the next block of code. Using python is like having to always have a tidy desk even while you work at it.

    Also I hate the stupid colons. What are they there for?

  • by BadassJesus (939844) on Wednesday January 11 2006, @07:27PM (#14450374)
    It is really hard to convice people when recomending such a phony name language like "Python". Outside of the knowing community people were always reluctant to compliment Python.
    In another words if Perl has the design of Python then i would be an giant. Python with shady syntax of Perl would be another unknown script language.
    Its like the "Skoda" brand will never be a fancy sports car maker. Some people will always find it revolting to even bother.
  • by The OPTiCIAN (8190) on Wednesday January 11 2006, @07:35PM (#14450427)
    (http://stable.cowoh.org/)
    I spent a while collecting python books whilst trying to get fluent in it. On the whole, they're a complete waste of time. The oreilly jython book was useful as a syntax guide (but with python having come so far since then I'd avoid it now), and the python cookbook is occasionally useful. It's one of those books you read through to learn solutions to problems you've encountered in the past, rather than in anticipation of patterns you might need.

    Basically - the python online documentation is adequate. It could have a few more examples in it, it's not as practically focussed as it might be, but it's better than anything else I've seen.

    Here's how I'd recommend learning python
    1) discpiline yourself to sit through a slab of the
    2) get really comfortable for the pattern of opening a file, reading lines from it, closing it
    3) get really comfortable with the pattern for list matching, [item.getName() for item in list] - this is gold
    4) try to solve a tiny problems with python a couple of times a week. It helps if it's practical. My first was a program that listed the files in a directory and wrote a html index page linking to them.

    If you can get this far, you're on the right path, and you don't need any books to get there. After this point you'll find yourself dropping into the python prompt to write little scripts to solve problems, and occasionally looking for modules to do slightly interesting things and - you're not there yet - but you're going to get there from this point. As time goes on become more familiar with lambda, map and reduce - these are fantastic, powerful approaches to solving poblems. If you haven't done any functional programming it's a bit weird to start with, but stick in there, it's worth it.
  • Artical summary blows it again. (Score:4, Insightful)

    by Hosiah (849792) on Wednesday January 11 2006, @08:20PM (#14450669)
    (http://www.penguinpetes.com/ | Last Journal: Tuesday March 14 2006, @03:38AM)
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    I just burned through the flamewall on this issue not three days ago. I use Python instead of Perl, love Python best of all languages currently, and may even like the book reviewed. But it is superstitiously ignorant to declare any language makes it "easier" to program in. Can we just once have a discussion of the strengths and weaknesses and merits and demerits of any language at all, instead of talking about it like it was a laxative? "Makes the code soft and it flows out smoothly!" No, it doesn't: nothing does; hard programs are hard to write, easy programs are easy to write. I'll even save the time and copy my closing argument from last time:

    I know a secret. It's a secret you only find out after programming for a while. It's one you obviously don't know if you ask me which programming language is the "easiest".

    There is this public perception, unanimous in user-land, and even permeating to the very depths of Slashdot, which goes: "Computers are only hard because evil computer programmers deliberately set out to make them hard." And the secret is: that that's a falsehood. Computers are not made artificially difficult. It does no good to tell you this; this is a special kind of secret that you can only learn through experience.

    The experience of struggling to design a usable user interface for your own system. The struggle to overcome the barriers of closed systems, lack of documentation, and misinformation everywhere you turn. The exasperation of dealing with users who come to you with the attitude that your program broke on purpose, you should fix it without knowing what the error was, and it's too hard to learn anyway because you make it difficult, because you're "evil".

    Programming experience erases that mental line drawn between user and programmer. You get experience on both sides of the fence, and eventually you see that there is no such thing as artificial complication. Interfacing with a machine upon which we have taught electricity to think and where we hope to make it sing and dance for us is inherently complicated TO START WITH, and the various tools we use to perform our tasks - why, each and every one was written by average people like you and me who also sat down with a clean file and furrowed their brow and wondered "How can I do this? How can I make it so people will use it?"

    No, you still have that mental mindset that there are programmers who deliberatly design things to be difficult, that it's all in spite, that they're laughing at you. Who, except as a joke, would deliberately make a programming language "hard to learn"? To fail at your task and blame your tool is simply a form of denial so that you don't have to face the fact that you have given up on trying to use something (no matter if it's COBOL or Javascript or Perl or freaking TECO, even!) that hundreds of other people have used successfully.

    There is no "easy". There is no "hard". There is only "Task".

    Now, you want to talk about an "easy" language? Binary, of course! Binary has just two commands (one and zero) so it's the fastest to learn, has cross-platform compatibility built-in (all computers know binary!), is easiest to test (no compiler or interpretter required, just "Rite 'n' Run"!), is readily available everwhere (ALL programs are "open source" in binary!), and needs no extension libraries (Binary can do it all!). If you thought this paragraph was stupid, this is how stupid the rest of you sound to me when you hyperfocus on "easy" and act like there's no other aspect to programming.

  • by oblivion95 (803698) on Thursday January 12 2006, @05:19AM (#14452656)

    The language warriors miss the point: Some languages are better for some tasks than other languages.

    Python is a wonderful language for part-time programmers. Why? Because Python ...
    * is very easy to learn (no weird symbols or idioms)
    * enforces indentation
    * encourages legible code (few side-effects)
    * encourages useful documentation (in the comments)
    * encourages testing (esp. doctest)
    * encourages modularity (via directory structure)
    * encourages OOP (defining a class is trivial)
    * can be extremely productive (with great libraries)

    I work with people who need to do a lot of work in a "glue" language, but they are not professional programmers. When they use Tcl, I cannot easily re-use, maintain, or extend (via C++) their code. Perl is better, but only because the resulting code is much shorter. These people use Perl and Tcl because that's what they know. Whenever I convert someone like that to Python, they and the people who use their code become more productive.

    Ruby is a wonderful language for a programmer, but is it simply not as easy to learn. The block-syntax (with ||) is awkward. Unless you know Perl, regular expressions are too terse. Modularity and OOP are simple but not trivial (which they must be or they will be ignored). Testing is easy, but documentation is as ugly as Perl's.

    Also, because of its slow speed, Ruby should be considered a proto-typing language, unless the application simply does not require speed. I think Ruby is perfect for web development, because its flexibility (e.g. mixins) makes the incomprehensible almost manageable.

    For proto-typing,
    if the target is C++, use Ruby (or Python + Boost);
    if the target is C#, use Boo;
    if the target is Java, use Jython.

    For embedding, I like Lua. It's small, fast, and easy to learn.

    For serious, large-scale, mission-critical systems programming, there are better choices than Python and Ruby: Ocaml (or F#), Haskell, Eiffel, Scheme, Ada, etc. The experience and taste of the programmer count more here.
  • by walterbyrd (182728) on Thursday January 12 2006, @08:18AM (#14453264)
    The competition for cheap web-hosters must be off the scale. Yet, they all compete in the same way, offering more drive space, or more download amounts. It seems like somebody would try to differentiate themselves by adding products that are free anyway.

    They all seem to want to offer PHP/MySQL. Couldn't they just as easily offer Python or Perl? And maybe PostgreSQL while they're at it? Python, Perl, and PostgreSQL, are all free, so why not?

    Although my experience in PHP/MySQL is limited, I consider both to be inferior technologies. PHP syntax is inconsistant, and the developers of PHP seem hell-bent on constantly breaking backward compatibily. Unlike Perl, or Python, PHP seems to be limited to web development only. I don't like MySQL's goofy subset of SQL. I also don't like MySQL strange licensing scheme. I don't like MySQL's partnership with scox either.
  • bash.org (Score:1)

    by Mr. Jax (686488) on Monday January 16 2006, @07:14AM (#14480855)
    From bash.org http://www.bash.org/?400459:

    <Sonium> someone speak python here?
    <lucky> HHHHHSSSSSHSSS
    <lucky> SSSSS
    <Sonium> the programming language
  • Re:Civilization IV is Python and XML (Score:3, Informative)

    by AuMatar (183847) on Wednesday January 11 2006, @02:41PM (#14448042)
    No it isn't. The AI scripts are. THe engine is C++.
    [ Parent ]
  • by Colonel Panic (15235) on Wednesday January 11 2006, @02:43PM (#14448062)
    How about How to Program [pragmaticprogrammer.com] by Chris Pine. I hear it's excellent for people who have no programming experience.

    Another good (and fun) choice is Why's Poignant Guide to Ruby [poignantguide.net]. No other learning to program book has cartoon foxes.
    [ Parent ]
  • Re:Damn perl bashing (Score:5, Informative)

    It is a bit harder to be legible in Perl than in other languages, to be fair, especially if you use regexps (but then, they're not all that legible anyway to begin with). Still, you get used to it after a while and it becomes as easy to read Perl as any other language.
    [ Parent ]
    • Re:Damn perl bashing (Score:4, Insightful)

      by pileated (53605) on Wednesday January 11 2006, @05:07PM (#14449400)
      I don't think that it's harder at all to be legible in perl. It's just that unfortunately perl culture encourages illegibility. A great book that doesn't is Damian Conway's recent Perl: Best Practices. What a breath of fresh air to see someone say that perl ought to be legible. Sad to say I think that the things that brought perl to it's early prominence are also the things that have hurt it in the long run: the ability to do something complicated extremely quickly. Unfortunately this seems to have encouraged "clever" programmers, who use every clever perl trick in the book. All that cleverness has become part of perl culture.

      Oddly enough I'm reading a book on Applescript right now (not because I really want to but because I need to write some fairly complicated scripts in it.) The book reminds me of perl in it's early days when it says how easy it is to do something or how Applescript magically does something for you, like understand whether you're in a string or math context. This seems good to beginners. But it the long run I think if lends itself to muddled code. There's just a little too much congratulations to each language for it's cleverness (and perl definitely is clever).

      As far as Python goes god knows I tried to read either Programming or Learning Python but I just gave up. It just didn't hold my interest at all. Give me Java, or legible Perl any day!

      [ Parent ]
    • 1 reply beneath your current threshold.
  • by east coast (590680) on Wednesday January 11 2006, @03:21PM (#14448435)
    Man, slashdot is getting rough when even a Python joke gets modded down...
    [ Parent ]
  • by Tachikoma (878191) on Wednesday January 11 2006, @03:23PM (#14448450)
    free pdf at www.diveintopython.org [diveintopython.org]

    i'm half way through and think it's great. gives you examples upfront, and then walks you through step-by-step as to what your doing.
    [ Parent ]
  • Of python specific literature, thinkcspy [ibiblio.org] is probably the best suited for absolute beginner who hasn't ever written a line of code in any language.
    [ Parent ]
  • by mollymoo (202721) on Thursday January 12 2006, @04:33PM (#14458300)
    (Last Journal: Friday December 17 2004, @07:14PM)
    Perl is as legible as the author makes it.

    And we all have to work with bad programmers some time or other. Of course none of us are bad programmers, it's always the other guy.

    By the way, you have fun with that whitespace requirement.

    Oh, I do. The idea freaked me out a bit at first, till I realised that my code and any other legible code I've ever seen was formatted like that anyway. Now I tend to look at all those {}s in other languages as ugly, redundant and little more than an opportunity for poor code layout to cause confusion. Humans look to indentation to define blocks of code when reading it, why shouldn't the language too?

    [ Parent ]
  • 18 replies beneath your current threshold.