Learning Python, 4th Edition: Python Learning Reloaded!

Author : Ahmed Al-Saadi

18 02 2010

Learning Python is a well-written book by an experienced Python trainer that has served the Python community well since the first edition was published, back in 1999. Now at its fourth edition, this book by Mark Lutz arguably continues to be Python’s bible. This article reviews the fourth edition by discussing the target audience, scope, content, and pedagogical features. It concludes by a recommendation.

Audience

This book is intended as an introductory text to programmers new to Python.  Although people with no programming experience are not discouraged from reading it, they are warned that time is mostly spent teaching Python, not programming fundamentals. I agree with this picture, though from my own experience as well as those of others, the book is equally valuable to more experienced Python programmers both as a pseudo-reference, and as an introduction to more advanced topics. The critical point here is that the book does not make assumptions about educational or vocational experiences and provides many examples, which renders the book approachable by a large audience.

Scope

Both Python 2.6 and 3.x are covered in this edition. However, the latest 3.x line is considered the reference from which variations in 2.6 are discussed when appropriate. This approach is logical; the new Python 3.x presents a major change to the language, but is not sufficiently dominant to warrant exclusive treatment.

This book discusses the Python language and excludes the Python standard and non-standard libraries. The latter are discussed in other places, including Lutz’s own Programming Python, which stands at its third edition at the time of writing of this article. I find this separation necessary because of size considerations and, in fact, this division did not exist in the first edition of the book! However, one topic does not seem to fit in the language/libraries division, and that is packaging and deployment.

I will argue that there aren’t many (if any) books that discuss packaging and deployment of Python programs. I will also argue that this topic should be included in the book being reviewed here since it is essential to real Python programming. Since Lutz discusses the Python run-time environment, I do not think it would detract from the book’s coherence to include a single chapter on packaging.  It is possible that the proliferation of various packaging and deployment options such as distutils, setuptools, pip, buildout, virtualenv, paver, fabric and others, is the reason for this exclusion. Or it could be that these tools are in a state of major flux that any text will be quickly outdated.  If size is the reason for this exclusion, maybe Lutz or someone else can publish a “Packaging and Deploying Python” as a separate volume.

Content

The book starts by making a case for the use of Python. Both the features of the language and its prominent users are discussed to build credibility. Then, the run-time environment is discussed: how to run programs in various ways on various operating systems and language interpreters.

Types and statements, which are at the core of any language, are discussed next. Notably, there is an excellent discussion on the topic of iterators and generators (both are also covered in a later chapter).  Functions, modules and classes are then introduced. The text also includes a discussion of general object-oriented programming (OOP) principles which I find to be invaluable, as it brings the topic of classes to life.

Exceptions are introduced and discussed in detail. The placement here is appropriate since exceptions are now objects in Python so classes had to be discussed first. This chapter should prove to be especially useful for people migrating from other languages that do not have simple, yet effective, exception-handling constructs.

Finally, four advanced topics are covered: decorators, unicode, managed attributes, and meta-classes. I find the first two to be absolutely necessary for almost any system nowadays, even the smaller ones! The latter two are not as ubiquitous, but should be useful to more experienced programmers.

I should mention here that the discussion of the topics mentioned above doesn’t stop at the basics, but provides comprehensive coverage. This is also the case with the discussion of topics such as dynamic typing, inheritance order, iterators, generators, comprehensions, and functional programming, among many others. There is even an interlude on documentation and the pydoc library.

Pedagogical Features

Like many programming texts, Learning Python uses small programming examples (appropriately executed in the Python interactive shell). These small examples hope to capture the essence of the topic at hand, and it does that well within the limitations of a small-scale context. This fourth edition adds a new chapter on classes (Chapter 27) that contains a more realistic code example presented in a tutorial format.

In addition to examples, each chapter ends with a summary of the chapter’s content as well as a quiz. The quiz is immediately followed by its answers for easy reference. I have to admit that I do not use any of these two features, so I will not be able to comment on their efficacy.

Conclusion

Like many O’Reilly books, this is a well-written, coherent, and beautifully type-set book. I highly recommend it to anyone who wants to, or already does, program using python. It should help the novice in their transition to an excellent programming language, or otherwise, make an already familiar environment more powerful in the hands of veterans.

About the reviewer: Ahmed Al-Saadi is a Software Analyst who works for a Montreal Python house. He wrote his first lines of code on a Sinclair ZX Spectrum+, though unfortunately not in Python at the time.



MontrealPython4 – Thursday September 25 @18h30

Author : arach

14 09 2008

We are back, with a new location and a cool presentation in store for you. Thursday September 25th @ 18h30 at http://labanque.ca/ - 175 Roy Map.  Our presentation will be from Hugo. Here is the intro.

Python for the machinist

In this presentation, I will show you how I use Python to create physical objects, circuits and machine elements. This presentation will walk you through simple python programs that generate instructions for CNC (Computer Numerical Control) equipment, and  include a live demo where a ‘useful’ object will be created  on a personal milling machine. There should be ample time left for an interesting technical discussion to follow.

We will have refreshments available (beer, soda) as well as some food.

Also, there will be time for lightning talks, announcements before the presentation. The registration is back on the wiki…  http://www.barcampmontreal.org/wiki/MontrealPython4



MontrealPython3 – thanks, link

Author : arach

27 06 2008

MontrealPython3 was a lot of fun. Martin Blais gave us 2 very interesting presentations. In case you missed it or want to follow up, you can find snakefood, beancount and more at http://furius.ca/home/software.html.

Thanks again to StandoutJobs for lending us their space and Akoha for the refreshments.

MontrealPython4 will be July 31st. We’ll have more details in the weeks to come.

 –Arach



MontrealPython3 – June 26 2008 @ 6:30PM

Author : arach

16 06 2008

MontrealPython3 will be held June 26 2008 @ 6:30PM. We’ll be meeting at Standout Jobs : 3981 boul. St. Laurent, Suite 615, Montreal. Going forward, we will do one presentation per meetup. This will be more convenient for lots of people, who have to leave before the end and feel bad about it…

Our presenter will be Martin Blais, who will give one of his proposed presentations (Snakefood / Beancount).

Read the rest of this entry »



It’s a good time to be a Python programmer!

Author : arach

31 03 2008

Grig Gheorghiu  from SoCal piggies says:

We had the SoCal Piggies meeting at the Disney Animation Studios last night. It was a great meeting — great presentations from Disney engineers on how they use Python at Disney (and they use it A LOT!), great food, great turnout, and great atmosphere. Let me tell you — the Disney Animation Studios are *lush*. Thanks to Paul Hildebrandt for organizing the meeting.

I’ll probably blog separately about the technical content of the presentations, but for now I just wanted to comment on the fact that everybody seems to be hiring Python programmers — Gorilla Nation and Virgin Charter are just two companies in the L.A. area that are aggressively looking to hire Python talent. Another thing: we used to have difficulties in finding venues for our meetings. We used to meet at either USC or Caltech, and around 10-12 people max. would show up. Now companies are clamoring for organizing the meetings at their offices, and we have 20-30 people in the audience, with many new faces at every meeting. Even more: Ruby on Rails programmers are showing up at our meetings, looking for an opportunity to be more involved with Python!

I take that as a sign that Python has arrived. It’s a good time to be a Python programmer

http://agiletesting.blogspot.com/2008/03/its-good-time-to-be-python-programmer.html



MontrealPython2 – sign up on facebook, the barcampmontreal wiki

Author : arach

25 03 2008

If you’re on facebook, here is the event page for MontrealPython2: http://www.facebook.com/event.php?eid=22020974904

If you haven’t already, please sign-up on the barcamp wiki: http://barcampmontreal.org/wiki/MontrealPython2

Let people know about our next meetup.



MontrealPython2 – second presentation about graphical programming with Python

Author : arach

19 03 2008

Yannick Gingras will be doing a presentation about graphical programming with Python.

For the first 35 mins, I can hack a toy app from scratch using PyQt and PyOpenGL.  After that, I will answer questions for 10 minutes.

I’m looking forward to that !

Arach



PyCon 2008 – Chicago

Author : arach

8 03 2008

PyCon 2008 is coming up next week, and it’s shaping up to be a great event.  You can find information at http://us.pycon.org/2008/about/, check out the blog http://pycon.blogspot.com/ . There is also a scheduler for the talks presented http://us.pycon.org/2008/conference/schedule/.

PyCon 2008, to be held soon in the Chicago area, has over 950 registered attendees at this time. That is over one and a half times the number of attendees from just the year before!

BTW. David Goodger who gave our first presentation ever is the Chair of the conference.

Anybody from MP going to be at PyCon?



A great first presenter, David Goodger – MontrealPython1 – Feb 7th 2008

Author : arach

31 01 2008

We have the pleasure of hosting a talk by David Goodger at MontrealPython1. This is a talk that will be presented at PyCon later this year, and it’s an honour for us to have a member of the Python Software Foundation with us on Feb. 7th 2008.

I invite everyone who’s planning to attend MP1 to take a look at the topic of the talk

 David Goodger (goodger [at] python [dot] org) regarding Polyform Puzzler (http://puzzler.sourceforge.net/) and Donald Knuth’s “Dancing Links Algorithm X” (DLX), anywhere from 10 minutes to an hour. Also, PyCon :-)

If you haven’t signed up yet, please edit the wiki page at http://www.barcampmontreal.org/wiki/MontrealPython1.

Thanks to all, looking forward to next Thursday

Arach

Nous avons le plaisir d’offrir une présentation de David Goodger à MontréalPython1. Cette présentation sera aussi présentée à PyCon en mars, et c’est un honneur pour nous d’avoir un membre de la Python Software Foundation avec nous le 7 février 2008.

J’invite tous ceux qui comptent être présent à MP1 à jeter un coup d’oeil au sujet de sa présentation.

 David Goodger (goodger [at] python [dot] org) regarding Polyform Puzzler (http://puzzler.sourceforge.net/) and Donald Knuth’s “Dancing Links Algorithm X” (DLX), anywhere from 10 minutes to an hour. Also, PyCon :-)

Si vous ne vous êtes pas encore inscrits, veuillez modifier le wiki à  http://www.barcampmontreal.org/wiki/MontrealPython1.

Merci à tous et à la semaine prochaine,

Arach



Call for presenters – first meetup coming soon!

Author : arach

14 11 2007

Montreal Python is alive and snaking (ref: A Frog In The Valley ).

We are planning to have our a first meetup very soon (the date and venue are going to be announced in the coming weeks). To make sure our first event is interesting, we would like to know what you would like to see. As the post says, we are also looking for presenters, so if you want to talk about any topic, business, project or python related activity, please let us know.

You can drop us a line at contact@montrealpython.org or just post a comment here.

Arach “we” Tchoupani

=

Montreal Python est vivant et … serpente !

Nous allons organiser notre première rencontre d’ici peu. Nous annoncerons le lieu et la date dans les semaines à venir. Comme c’est une première rencontre, nous sommes intéressés à savoir ce dont vous aimeriez discuter. Nous cherchons des présentateurs, alors si vous avez un sujet, un projet ou une entreprise à présenter, faites-nous signe.

Vous pouvez envoyer un courriel à contact@montrealpython.org ou simplement écrire un commentaire ici.

Merci,

Arach “nous” Tchoupani