★ wanayoo — archive 1999 http://www.pythonlabs.com/tech/python2.htmlNouvelle recherche | Portail wanayoo
PythonLabs.com
PythonLabs.com
A Member of the BeOpen Network
  HOME
  NEWS
  TEAM
  PLANS
TECHNOLOGY
  FAQ
  QUOTES
  TALKS
  DOWNLOADS
  RESOURCES
  CONTACT US
back to TECHNOLOGY
Python 2.0

[Scroll down to: download, bugs & incompatibilities, what's new.]

While Python users have grown fond of Python's exceedingly small version number increments, those low version numbers make parts of the rest of the world think that Python is barely out of its first alpha test. Especially enterprise customers are often fearful of anything that's version 1.x! The new version number also marks the opening of PythonLabs.

In the past, the version number 2.0 was associated with a mythical and elusive incompatible future release. That release -- still in the far future, but not as incompatible as people fear! -- is now referred to as Python 3000.

There will be one or two more 2.x release in late 2000 or early 2001, and there may be bug fix releases in the interim. We will start work on Python 3000 as the 2.x release cycle is winding down.

Download

Python 2.0 beta 1 will be released soon

Until then, Python 1.6 alpha 2 is available for download! There is both a source tarball and a Windows installer.

The previous alpha 1 release is still available for comparison: source tarball, Windows installer.

Windows resource usage: Python 1.6a2 needs about 16 Megabytes of disk space - this includes nearly 5 Megabytes of HTML documentation. Add Win32all, and the total goes up to 25 Megabytes. IDLE, when running, uses about 8-10 Megabytes of RAM (but could grow much larger depending on the code you run).

Downloading the source tarball on Windows? Make sure to give the file a ".tgz" extension, even though your browser suggests a ".tar" extension. The browser lies! To read the source tarball on Windows, you can use WinZip.

For Pythonwin and COM support, you need build 131 or higher of Mark Hammond's win32all package - this is for Python 1.6 only. (Note: use build 130 for Python 1.6a1; use build 131 or higher for Python 1.6a2 or later.)

Bugs

Yes, there will be bugs. Please don't mail them to me directly; use the Python Bugs List to report bugs. If you have a patch with your bug, please use the standard Patch Submission Guidelines.

Incompatibilities

See below for expected code breakage.

3rd party extensions built for Python 1.5.x cannot be used with Python 2.0; these extensions will have to be rebuilt for Python 2.0.

On Windows, attempting to import a 3rd party extension built for Python 1.5.x usually results in an immediate crash; there's not much we can do about this.

What's New in Python 2.0

See also a longer article by Andrew Kuchling and Moshe Zadka on this topic.

What's New in Python 1.6a2

Lots of bugs in the Unicode support have been fixed.

Some bugs in others parts of the code have been fixed.

A common crash on Windows in IDLE (typically when closing a window) has hopefully been fixed by going back to Tcl/Tk version 8.2.3; apparently version 8.3.0 has an instability here.

The exception AttributeError will have a more friendly error message, e.g.: 'Spam' instance has no attribute 'eggs'. This may break code that expects the message to be exactly the attribute name.

The Windows installer now installs by default in \Python16\ on the default volume, instead of \Program Files\Python-1.6\.

The Windows installer now installs the full 1.6 Python documentation in HTML form (as a result, it needs about 4 Megabyte more disk space).

The Windows installer now puts the Python16.dll file in the system directory, where it belongs. Other DLLs (e.g. Tcl/Tk, expat) go into the DLLs subdirectory, where they will be found only as dependencies of the extension modules also living there. Note that this move breaks Mark Hammond's win32all build 130. You can wait until Mark releases build 131 which should fix this, or if you're brave and in a hurry, you can manually move python16.dll from \windows\system (or \winnt\system32) to the Python root directory before running win32all-130.

The Windows python16.dll file is a lot leaner (around 600K, like it was in Python 1.5.2); the unicodedata, _socket and select extensions have been moved to separate DLLs.

What's New in Python 1.6 alpha 1

Moshe Zadka has kindly compiled an (undoubtedly incomplete) list of highlights, from which I borrow heavily here.

This list is still incomplete! Please help - if you notice or remember an important change, let me know (guido@python.org).

Expected Code Breakage

A few folklore APIs (that were never documented or endorsed but nevertheless were accepted and in common use) have been tightened. This is likely to break old code. This affects mainly list.append() and socket.connect(), which now strictly require a single argument (possibly a tuple). For example, where you used to be able to write people.append(firstname, lastname) you now have to write people.append((firstname, lastname)); where you used to write sock.connect(host, port) you must now write sock.connect((host, port)). Also affected are list.insert(), list.remove(), list.count() and dict.has_key().

The "nice" string representation of long integers no longer has an 'L' suffix. For example, print 10L**10 now prints 10000000000 where it used to print 10000000000L. This affects str(long) too; code breakage is expected for code that tries to strip off the 'L' without looking, like this: print str(x)[:-1]. You can use repr(), which returns the 'L' suffix as before.

The repr() of floating point numbers now gives full (17-digit) precision. This means that a number like 8.1 (which cannot be represented exactly in binary) will show up as 8.0999999999999996 when displayed using repr(). This shouldn't break any code but it may confuse users, especially since the interactive shell uses repr() to display all floating point results. Use str() or explicit precision in string format (e.g. "%.12g" % x) to see the the more familiar, rounded form.

We plan to do away with the -X command line option (which in Python 1.5.x turns all standard exceptions into strings). All standard exceptions will always be classes. String exceptions in user code will still be supported, but are discouraged. (Not yet in alpha 1 or 2.)

Obligatory

A lot of bug-fixes, some optimizations, many improvements in the documentation. (The Python 2.0 documentation will be released on a separate schedule from the implementation.)

Core Changes

Deleting objects is safe even for deeply nested data structures.

Long/int unifications: long integers can be used in seek() calls, as slice indexes.

UnboundLocalError is raised when a local variable is undefined. This is a subclass of NameError so no code breakage is expected.

The built-in functions long() and int() take optional "base" parameter. This makes string.atoi() and string.atol() obsolete. (String.atof() is already obsolete.)

String objects now have methods (though they are still immutable).

String formatting (s % args) has a new formatting option, '%r', which acts like '%s' but inserts repr(arg) instead of str(arg). (Not yet in alpha 1.)

Unicode support: Unicode strings are marked with u"string", and there is support for arbitrary encoders/decoders. There are new built-in functions unicode() and unichr(), and lots of other things have changed (especially a slew of new C API functions). For more information, see Andy Robinson's Python Unicode Tutorial, the original the Unicode Proposal Text by Marc-Andre Lemburg, and also the I18n-SIG home page.

The "in" operator can now be overriden in user-defined classes: it calls the magic method __contains__.

New calling syntax: f(*args, **kw) is equivalent to apply(f, args, kw). This can also be combined with regular arguments, e.g. f(1, 2, x=3, y=4, *(5, 6), **{'p': 7, 'q'=8}) is equivalent to f(1, 2, 5, 6, x=3, y=4, p=7, q=8). Common usage is for base class methods:

 def
method(self, *args): BaseClass.method(self, *args) ...  

New Modules

UserString - base class for deriving from the string type.

distutils - tools for distributing Python modules.

robotparser - parse a robots.txt file, for writing web spiders. (Moved from Tools/webchecker/.)

linuxaudiodev - audio for Linux.

mmap - treat a file as a memory buffer. (Windows and Unix.)

sre - regular expressions (fast, supports unicode). Currently, this code is very rough. Eventually, the re module will be reimplemented using sre (without changes to the re API).

filecmp - supersedes the old cmp.py and dircmp.py modules.

tabnanny - check Python sources for tab-width dependance. (Moved from Tools/scripts/.)

urllib2 - new and improved but incompatible version of urllib (still experimental).

zipfile - read and write zip archives.

codecs - support for Unicode encoders/decoders.

unicodedata - provides access to the Unicode 3.0 database.

encodings - package which provides a large set of standard codecs -- currently only for the new Unicode support. It has a drop-in extension mechanism which allows you to add new codecs by simply copying them into the encodings package directory. Asian codec support will probably be made available as separate distribution package built upon this technique and the new distutils package.

Module Changes

re - will be changed to be a frontend to sre (not yet in alpha 1).

readline, ConfigParser, cgi, calendar, posix, readline, xmllib, aifc, chunk, wave, random, shelve, nntplib - minor enhancements.

socket, httplib, urllib - optional OpenSSL support.

_tkinter - support for 8.0 up to 8.3. Support for versions older than 8.0 has been dropped.

string - most of this module is deprecated now that strings have methods:

  • No longer uses the built-in strop module, but takes advantage of the new string methods to provide transparent support for both Unicode and ordinary strings.
  • The maxsplit argument defaults in split() and replace() have changed from 0 to -1.

Windows Changes

The installer no longer runs a separate Tcl/Tk installer; instead, it installs the needed Tcl/Tk files directly in the Python directory. If you already have a Tcl/Tk installation, this wastes some disk space (about 4 Megs) but avoids problems with conflincting Tcl/Tk installations, and makes it much easier for Python to ensure that Tcl/Tk can find all its files. Note: the alpha installers don't include the documentation.

The installer no longer installs some of its DLLs in the Windows System directory; instead, all DLLs go into the Python root directory. This will probably break Mark Hammond's COM support; we'll figure out what to do about that after alpha 1 is released. (Maybe the old policy has to be restored.)

New module winreg - Windows registry interface.

Tool Changes

IDLE - complete overhaul. See the IDLE home page for more information. (Python 1.6 alpha 1 will come with IDLE 0.6.)

Tools/i18n/pygettext.py - Python equivalent of xgettext(1). A message text extraction tool used for internationalizing applications written in Python.

Obsolete Modules

stdwin and everything that uses it. (Get Python 1.5.2 if you need it. :-)

soundex. (Skip Montanaro has a version in Python but it won't be included in the Python release.)

cmp, cmpcache, dircmp. (Replaced by filecmp.)

dump. (Use pickle.)

find. (Easily coded using os.walk().)

grep. (Not very useful as a library module.)

packmail. (No longer has any use.)

poly, zmod. (These were poor examples at best.)

util. (This functionality was long ago built in elsewhere).

whatsound. (Use sndhdr.)

 


Home | News | Team | Plans | Technology | FAQ | Quotes | Downloads | Resources | Contact Us | Terms of Use | Privacy Policy | Send Us Feedback top
sponsors
Visit the BeOpen Network Sites: BeOpen.com, LinuxDev.net, GNULinux.com, PythonLabs.com