Print
Python News

New Versions of Zope and Python

07/24/2001

To keep my mind off not attending the O'Reilly Open Source Conference, I have had my head buried in new versions of Python and Zope.

On the surface, Zope isn't much changed in version 2.4. It is still the same basic tool for publishing web objects. Behind the scenes, it's powered by Python 2.1 instead of Python 1.5.2. This opens up Zope to future enhancements, taking advantage of Python 2.1's support of unicode and garbage collection, but nothing in Zope 2.4 takes advantage of this. What I have found better about Zope 2.4 has little to do with Zope itself. The documentation is better. Michael Pelletier's Zope book (published by New Riders) is available online and some of Zope's help system references it, including a new section in the Zope Tutorial that covers using Zope with a relational database. I like the way the built-in help, the tutorial, and the Zope book all support each other.

Version 1.1 of the Content Management Framework (CMF) seems to work fine with Zope 2.4. I was afraid using Python 2.1 would break it. CMF 1.1, released last month, provides tools for, well, managing content. With CMF you can build sites like Slashdot, with membership and customizable web pages, user contributed news stories, even news syndication via RSS. Unfortunately, playing with CMF reminded me too much of the Open Source Conference, where there will be no less that three CMF events, a Tuesday tutorial, a Wednesday BoF, and a Friday overview. <sigh>

So I turned to playing with the alpha version of Python 2.2. Python 2.2 introduces generators. You might think of a generator as a function with state, as a resumable function. Each time you call one, it takes up where it left off. Among other things, you can use them as iterator factories, creating objects that will return, or rather yield to you, the next item in a sequence. The concept for generators is laid out in PEP 255. That is the primary documentation for now. It is a good introduction, but even better than this documentation is the large collection of generator examples that can be found in test.test_generators which comes with Python 2.2a. This file contains examples from the PEP, examples contributed on comp.lang.python, and more.

Iterators are themselves new; basically it's something that can be looped over. In Python 2.2, you can define how an object loops by defining an __iter__() method. Iterators are now a part of the underlying mechanics of a for loop, which no longer expects a sequence, but rather something over which it can iterate.

There are more changes for Python 2.2. Nested scopes, introduced as an optional feature in 2.1, will be enabled by default in 2.2. Fredrik Lundh's xmlrpclib, covered in several O'Reilly Network articles, will be added to the standard library. A.M. Kuchling covers all these new features and more inWhat's New in Python 2.2.

For those in San Diego, hope you are enjoying the sun. I am going to keep playing with my new... errm, working with my new tools.

Stephen Figgins administrates Linux servers for Sunflower Broadband, a cable company.


Read more Python News columns.

Return to the Python DevCenter.