By Ingeniweb. A Django site.
Novembre 27, 2008
» Expert Python Programming Book : typo sprint tonight !


I love Packt. As soon as I have told them that some people liked the book but complained about the typos, they proposed to go ahead and launch a new print cycle.

Basically it means that the next buyers will have a typo-free book. At least for all the typos that were reported on my Trac here, or at Packt’s.

I am currently processing all the typos reported at Packt so I have a full list on my wiki, and will provide them the final list tomorrow.

Then, they will re-print it.

So if you already own the book, and you see a typo that is not listed, please let me know.

      

Novembre 22, 2008
» How to be disappointed with the “printed” in “printed book”


I feel really bad about this comment on my book : How To Be Dissappointed in Something You Recommend.

Just a quick word about the try, return finally code pattern, since I had some feedback about it. I would like to mention that this code pattern is perfectly right:

def function():
    try:
      return something
    finally:
      do something

I should have explained it better, because this pattern is not used a lot by people, so you can think that “do something” is called after the return of the function, which is not the case.

For the typos now:

The first thing I did wrong: when I started the book, I wanted, as I did in my previous book, to run unit tests on the book itself to avoid those mistakes. That said, the previous one was in Latex, which is quite simple to interact with, and this one is in OpenOffice, because that is how the editor works. I had to write a script to extract the Python code from the Ooo file, to unit test it. I didn’t. I simply ran out of time, as usual when you have deadlines on books.

The second thing I did wrong: I should have told the editor to wait a bit, I didn’t.

But Packt does Print On Demand, so I know that the Errata page I am maintaining here : http://atomisator.ziade.org/wiki/Errata, is being processed by the editor, and that the typos will be removed from the book at some point, without having to wait for a second edition.

I’ll update this blog entry as soon as I know the status on this.

I am really sorry Calvin, and all the people that are suffering from these typos.

      

Septembre 24, 2008
» Expert Python Programming book, more details + sample chapter


It seems that my book is now officialy available, so I should give more details about its content.

Who should get this book ?

I think Shannon described the targetship of my book quite well in the foreword:

If you’re looking to progress from knowing Python to mastering Python, this is the
book for you. In fact, this is exactly the type of book I wish I had had five years ago.
What took me years to discover by steadfastly attending talks at PyCon and my local
Python users’ group is now available in a succinct book form.

What is means is that this book does not only focus on Python syntax, but also covers how to use Python in a professional environment. Beyond writing a program that works, a good Python developer uses continous integration principles and tries to think about the maintainability of his code. Taking care of choosing good names for instance, will naturally make the code better. Test-Driven Development make the code better too.

The book tries to synthesize these good practices and explain why they are good. So if you are using Python and know how to write a program, and want to push it further, this is a book for you.

On the code

All the code of the book lives here: http://atomisator.ziade.org. So it can evolve.

On my English

I am French. My english is far from being perfect. The Packt team did a great work on improving it, but you will probably feel my french touch in the book. I hope you won’t mind.

On the structure

Depending on your needs, you might feel that the ordering of the chapters is not what you were expecting. The current ordering is the one I would use when writing an application, but this is my own vision. If you are a manager you probably have your own way. I worked this out with one concern in mind : every chapter is independant. So feel free to jump to any chapter when you have finished one.

Sample chapter

I am giving away Chapter 10, as an appetizer: chapter 10 of “Expert Python Programming”

This chapter is about documentation. It gives principles and good practices to document your Python projects. It is an invitation to use Sphinx and reStructuredText, together with a set of good practices.

More details on each chapter

Chapter 1, Getting Started. I took me a long time to decide whether I should drop or not this chapter. It describes how to install an environment to work with Python. Since the book is for people that already knows how to use Python a bit, it seemed out of topic.

A few things convinced me to let it in: I have a friend that works with Python under Windows for years, but don’t know anything about distutils or setuptools and how to set the proper MinGW environment to be able to install packages without having any trouble. Secondly: I am making some assumptions there for the rest of the book examples to work and I am a setuptools fan. Last but not least: this is a small chapter compared to the size of the book (less than 10%)

Chapter 2, Syntax Best Practices—Below the Class Level, I had a lot of fun there. I am talking about topics like coroutines and contextlib. Pure Python joy !

Chapter 3, Syntax Best Practices—Above the Class Level, This chapter explains amongst other topics why super() is dangerous, how the MRO works, meta-programming, etc. Lots of fun too. I think people will enjoy it a lot.

Chapter 4, Choosing good names, Writing a program that works is a good thing. Writing a program that can evolve and that is comprehensible by other developers is harder. This chapter will give you some clues on choosing good names, beyond the PEP8 guide, and how to organize and build a modular application by working out the API.

Chapter 5, Writing a package. The main ideas here are: write and distribute all your packages the same way, so use templates and distutils.

Chapter 6, Writing an application. Same as chapter 5, but at the application level. This field is very different depending on what frameworks you use and what community you are part of. I tried to come up with something that seems to be the way all developers are tending to take. Maybe I am a bad visonnary, maybe I am wrong. I don’t think I am. If you disagree, you will still find interesting stuff in there.I am presenting a micro case study to make things clearerild a modular application by working out the API.

Chapter 7, Working with zc.buildout. Buildout is widely use in Plone and Zope. There are other tools out there of course. But buildout rocks imho. This chapter show how it work and how to use it to work and distributeyour application.

Chapter 8, Managing code. Its starts with a state-of-the-art of version control systems and continuous integration principles. I am explaining how you can work using mercurial and buildbot.

Chapter 9, Managing lifecyle. Same as chapter 8, but focusing on software lifecycles, and why the iterative approach rocks. Also show how trac can be used.

Chapter 10, Documenting your projects, Just read it :)

Chapter 11, Test-Driven Development, This is my TDD manifesto :)

Chapter 12 and 13, Optimisation, Ever wondered how to calculate the complexity of the code ? how to benchmark and optimize ?

Chapter 14, Useful design patterns, Design patterns revisited, because the GoF did not know enough about Python :)

Feedback !

It is really frustrating in some way to write a printed book on a topic like Python. By the time I have finished the book and gave it back to the editor, I was already thinking on some changes and some improvments I could make.

I created a website for the readers : http://atomisator.ziade.org

You can add a ticket there for the v2 !

      

Août 8, 2008
» A new Python book : “Expert Python Programming”


The Packt team added a page about my new book, which will be out sometimes in September, so I guess it is the right time for me to announce it here !

So here comes “Expert Python Programming”, where I explain how we work with Python every day to create software.

This is my first book in English, and writing in another language was quite challenging ;)

Anyway, this book is intended for developers that already have a background in Python and covers only advanced topics (see the editor details). But as I said, it explains how we develop our applications in Python so topics like continuous integration, documentation, testing, releasing, refactoring, etc. are covered.
Managers will also have a good overview of how a Python project can be run and managed, using modern tools like Distributed Version Control Systems (Mercurial for instance) or Buildbot.

Even if I am working on Zope and Plone these days, I have focused on writing a book that is only about Python, to make it useful to any developer. The fact that my friend Shannon did the technical reviewing helped on this : he doesn’t use Zope too much so he was close to the target readership.

I will take more time when it comes out to announce it in the various mailing lists, and to get into greater details about the content that will be available online besides the book (some Python packages, etc)

I can’t wait to see it out and hold it :D