03 June 2012

Mark Lutz - Learning Python - 4th Edition - EBook Review

Blender is a very flexible 3D modeling application. The range of features and functionality are designed such that an artist can, with as little effort as possible achieve their modeling goals. Blender achieves this aim using multiple different approaches. If you are the typical Blender user, you gain access to most of Blenders features through the Graphical User Interface (GUI) (buttons, check boxes, icons), Addons and various keyboard shortcuts. Using just these methods the vast majority of Blenders functionality is exposed to the typical Blender user, weather that user be a new Blender user or an experienced user. For most users that is all that is needed to carryout the majority of tasks.

What is somewhat less well known is that a lot of Blenders functionality is derived from a programming language that is developed separately from Blender itself, even though a version of the language ships with all versions of the 2.5x series of Blender. That language is Python, a very powerful programming language used behind the scenes in Blender to provide large amounts of Blenders functionality.

For example the way in which Blenders GUI reacts to user interaction, is to large extent controlled by the Python language, as are many other features of Blender, such as Addons and other features which rely on Python to carryout out their tasks for them.

Now probably at this point some are thinking, so what's the big deal about Python being used by Blender? Well Python does not just provide a fixed, unchanging, set of features to Blender, you can extend and change how Blender works by altering or writing new Python scripts, using the Python programming language. If you don't like the way a particular interface feature is laid out, you can change it, and if you want a entirely brand new feature added to Blender, then it is often possible to add it using just the Python programming language.

However because Python the programming language is developed separately from Blender, you generally won't find much information from the Blender creators on learning the Python core programming language. If you need information on how to understand the core language of Python you need to look somewhere else.

Thankfully Python is a very popular programming language because of its flexibility, and as result there are many books written on how the Python language works, its rules, so to speak.

Product Specifications:
  • Name: Learning Python - 4th Edition
  • Author: Mark Lutz
  • Price: $39.99 (EBook PDF version)
  • Type: EBook
  • Pages: 1216
This is one such book written by Mark Lutz. It goes into extensive detail on how most of the Python language works. This means that by default it's a large tome coming in at more than 1200 pages, so it is definitely not a quick read, though it does cover almost every aspect of Python language that you are likely to need.

In some respects it is often too detailed, as it also covers topics that I doubt any Blender user would need to know, but this is not the fault of the book and more as issue of Blender not using a particular feature. But too much information is never a bad thing in my opinion, you never know when you may need that extra bit of information as your Python skills grow.

Topics Covered:
  • Chapter 1 A Python Q&A Session
  • Chapter 2 How Python Runs Programs
  • Chapter 3 How You Run Programs
  • Chapter 4 Introducing Python Object Types
  • Chapter 5 Numeric Types
  • Chapter 6 The Dynamic Typing Interlude
  • Chapter 7 Strings
  • Chapter 8 Lists and Dictionaries
  • Chapter 9 Tuples, Files, and Everything Else
  • Chapter 10 Introducing Python Statements
  • Chapter 11 Assignments, Expressions, and Prints
  • Chapter 12 if Tests and Syntax Rules
  • Chapter 13 while and for Loops
  • Chapter 14 Iterations and Comprehensions, Part 1
  • Chapter 15 The Documentation Interlude
  • Chapter 16 Function Basics
  • Chapter 17 Scopes
  • Chapter 18 Arguments
  • Chapter 19 Advanced Function Topics
  • Chapter 20 Iterations and Comprehensions, Part 2
  • Chapter 21 Modules: The Big Picture
  • Chapter 22 Module Coding Basics
  • Chapter 23 Module Packages
  • Chapter 24 Advanced Module Topics
  • Chapter 25 OOP: The Big Picture
  • Chapter 26 Class Coding Basics
  • Chapter 27 A More Realistic Example
  • Chapter 28 Class Coding Details
  • Chapter 29 Operator Overloading
  • Chapter 30 Designing with Classes
  • Chapter 31 Advanced Class Topics
  • Chapter 32 Exception Basics
  • Chapter 33 Exception Coding Details
  • Chapter 34 Exception Objects
  • Chapter 35 Designing with Exceptions
  • Chapter 36 Unicode and Byte Strings
  • Chapter 37 Managed Attributes
  • Chapter 38 Decorators
  • Chapter 39 Metaclasses
The large number of chapters help to split up the topics covered into semi-manageable chunks, though some chapters do seem a little large to me, while others could have been given more room. This is only a small niggle as generally the quality of information is excellent and goes into enough detail to make topics clear. I especially found the chapters on Lists, Functions, and Class construction very useful, which is fortunate because Blender Python uses both extensively.

I had problems occasionally with some of the more advanced topics later in the book, with such things are decorators and managed attributes, which I think could have been explained in a clearer and less verbose way. It seemed to me that at times it described some topics in a more complex way than was needed. That said, I am no Python expert and it could just have been me being a little slow. This is one area where there is a slight problem, the book does not assume you know anything about programming, although it does occasionally make references to terms and features of other programming languages and expects you to get the reference, which can be a bit distracting. It does not happen often but it is something to be aware of, and on the whole it doesn't affect learning much.

Given the page count of the book I think the price is very reasonable, though you could argue that you could get the official Python manual for free, which has all the information in this book and more. But having tried to make sense of the official Python manuals, I found them very difficult to understand. Which is not surprising as often official manuals are more references than tools to teach the language. Once you know the Python language, the official Python manuals are unbeatable as references but when you are learning like me, Lutz's book really makes things easier to get a grasp of.

It is worth stating that this book will not teach you how to use Python inside of Blender (i.e. use Python to talk to the Blender Python API), that book has yet to be written. But if what you want is a book that teaches the fundamental language rules of Python 2.6 and 3.x, this is the book to have.

So in summation, I think this book is well worth the time and effort it takes to read. If you are new to Python it will teach everything you need to know and a whole bunch of stuff you may never need. While if you are experienced in Python it's a good memory jogger for some of the more esoteric aspects of the Python language rules, though you may be better off going direct to the official Python manuals if your so experienced.

Now if only we could get a halfway decent Blender Python API tutorial type book all things would be rosey. Though someone would have to kidnap Campbell Barton and force him at gun point to write it, as the wiki version currently does not cut it.

Review Score 80%