mike watkins dot ca : December 5 2008 Archives

December 05 2008

Why Python 3?

Now that Python 3.0 has been released I suppose it's not surprising to see some strains of "why Python 3" floating around the blogosphere. I'd like comment on this from the perspective of a Python language user (which I am), rather than as a Python language developer (which I am not).

Jesse Noller laments for a lack of time, and perhaps patience, to respond to some of the not well founded criticisms of the new language branch. Here's one contribution Jesse, and while I'd rather not write about something so pedestrian as raw performance, as the subject has come up in recent discussions, it seems appropriate and necessary to do so.

What I'd rather do is muse about the future, as Chad Whitacre writes in "Why is Python 3 important?" where he proclaims "Python 2 is great; Python 3 is masterful". Perhaps I'm not fully qualified to speak to this, but I know what I like.

In other lives and for equal parts recreation and frustration I write a fair amount of English prose. When I have time to, I even try to make my writing somewhat artful. Never will I tire of the flexibility of the English language to be bent in oh so many ways to deliver a message.

I would not wish to compare the English language to Python, as there is certainly more than one way to express a thought in regular prose while there's only one way to do it is a key design objective for Python.

What I get out of writing prose is appreciation for composition and design, whether I wrote the piece or not. One doesn't have to be a CS graduate to appreciate clean design in a language, any more than you don't have to be an engineer to appreciate a fine bicycle.

As I've worked with Python 3 over the past few months I've come to appreciate and understand most of the design choices the developers have made. Like a well structured essay, Python 3 gets its point across clearly and with a minimum of fuss.

Aside from a general tightening up of the language and standard library, in particular I greatly appreciate the vast improvements made to ... strings. Working with Unicode is now a pleasure, and largely automatic. For many it will just work, something that can not be easily said about the prior Unicode implementation. That alone is worth the price of admission.

Overall Experience with Python 3: Positive

I can't recall if I felt conflicted about Python 3 before I took a serious look at it, but if I did, I certainly do not now feel that way after having spent some quality time with Python 3 over the past several months.

In conjunction with helping do some quality assurance testing on the QP web framework and related packages, I ported my company's library and one key application to support simultaneously 2.6 and 3.0. In making this transition I've had broad exposure to most of the changes in Python. I don't recall cursing too much through the experience, although truth be told I did initially miss __cmp__. Reading the What's New in Python 3.0 page, many times, is certainly a prerequisite to any porting adventure. One of the authors of QP and related packages recently posted a summary of the steps they took to achieve dual compatibility with Python 2 and 3.

The most significant syntax change that proved problematic was the syntax change for metaclass use. David Binger of the MEMS and Nanotechnology Exchange had come up with a novel workaround that I'd never have come up with myself, even if I did understand it, but it still hurt my brain. Luckily a little naive web searching and some playtime in the interpreter brought me to a neater solution which even I understand.

The QP 2.1 release experience seems to demonstrate that well crafted packages should not be too difficult to port. Some applications and packages might even make sense to support, against the official recommendations, both Python 2.x and 3.x off the same code base.

B.C. A.G.: Report on School Seismic Safety

Public school advocates have been waiting for some time to get a look at the British Columbia Auditor General's report: Planning for School Seismic Safety (PDF, attached). [Update: link corrected]

Much of the report's careful bureaucratese will put you to sleep. I find it falls short of evaluating the Ministry of Education (MEd) in one key area: timeliness. The abysmal pace of reconstruction project approvals since 2004 suggests that MEd has intentionally delayed project approvals.

One snippet from the report I'd like to highlight here:

The program proposal approved by the Minister of Education in 2004 included four delivery options:

  • ministry project delivery — the ministry funds within the „„current project delivery framework;
  • central agency — central agency established to implement the „„program and manage the projects;
  • long-term school board — the ministry develops a long‑term „„implementation plan and performance contracts with individual school boards to implement the program; and
  • long-term public/private — government develops a long‑term „„implementation plan providing opportunities for the private sector to deliver the program.

Ministry management recommended that the fourth option, a public‑private partnership, be chosen to deliver the program, but did not include an evaluation of each of the options.

Since 2004, the ministry has explored different ways of managing the Seismic Mitigation Program and of providing support for boards of education. Among the options tried has been the use of a public‑private partnership for delivering projects across school districts as originally planned and, when that did not prove viable, contracting with other government agencies for project oversight services.

However, after more than three years, the ministry has still not identified a delivery model that meets the needs of all stakeholders. The ministry is exploring a model designed to provide additional oversight while providing funding and resources to boards of education to help them build capacity to effectively manage their seismic projects.

Bottom line: ideology - the Premier's Partnerships BC program - has distracted and delayed critical seismic safety upgrades and school reconstruction project approvals. While the approach may make sense for some projects, it has not proven to be so for school upgrade and reconstruction programs.

We should not allow experiments with different business models to delay what are life-safety issues in hundreds of B.C. schools. Children, staff, parents and other facility users in these schools are at risk and the work required is not optional. Hundreds need to be upgraded or rebuilt, and there is a fixed cost to that reality which won't much change no matter what business model is employed. Surely the Minister responsible can see now that applying human resources to the problem, and increasing annual funding to the program, is the only way forward.

Lets get on with it.