Python 0.9.8 released

Guido.van.Rossum@cwi.nl
Sat, 09 Jan 1993 21:31:04 +0100

I have finally released the long-awaited Python version 0.9.8. Boy
has it been a heavy delivery! But the baby is healthy as can be...

You can ftp it from the following sites:

Location Site IP address Directory

Amsterdam ftp.cwi.nl 192.16.184.180 /pub/python
U.S.A. wuarchive.wustl.edu 128.252.135.4 /pub

The filename is python0.9.8.tar.Z. (Note the changed directory name
on ftp.cwi.nl!) There's also a file containing PostScript of the
documentation (tutorial, reference, library): pythondoc-ps0.9.8.tar.Z.
I'm sorry, there are no Mac or PC versions yet.

The version on wuarchive is likely to evaporate some time after it is
installed; I will try to make sure that the version on ftp.cwi.nl is
always there. You are invited to copy these files to other ftp
archives to which you have access.

Below is an exhaustive list of changes since 0.9.6 (which most of you
are probably still using).

If you wonder what happened to 0.9.7: there was a 0.9.7beta, which
was a little rough, and instead of polishing it up a bit, I went ahead
and made many more changes, so eventually I felt myself forced to call
it 0.9.8.

If you experience any kind of trouble with building or using 0.9.8,
please mail a short description giving as much detail as possible
about what system and configuration you are using and what kind of
error messages you get, either to the list, or to me (if you fear it
might be your own fault and don't want to be embarrassed). In all
cases I will try to do something about it, providing either a
work-around or patch.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>

==============================
==> NEWS FOR RELEASE 0.9.8 <==
==============================

I claim no completeness here, but I've tried my best to scan the log
files throughout my source tree for interesting bits of news. A more
complete account of the changes is to be found in the various
ChangeLog files. See also "News for release 0.9.7beta" below if you're
still using release 0.9.6, and the file HISTORY if you have an even
older release.

--Guido

Changes to the language proper
------------------------------

There's only one big change: the conformance checking for function
argument lists (of user-defined functions only) is stricter. Earlier,
you could get away with the following:

(a) define a function of one argument and call it with any
number of arguments; if the actual argument count wasn't
one, the function would receive a tuple containing the
arguments arguments (an empty tuple if there were none).

(b) define a function of two arguments, and call it with more
than two arguments; if there were more than two arguments,
the second argument would be passed as a tuple containing
the second and further actual arguments.

(Note that an argument (formal or actual) that is a tuple is counted as
one; these rules don't apply inside such tuples, only at the top level
of the argument list.)

Case (a) was needed to accommodate variable-length argument lists;
there is now an explicit "varargs" feature (precede the last argument
with a '*'). Case (b) was needed for compatibility with old class
definitions: up to release 0.9.4 a method with more than one argument
had to be declared as "def meth(self, (arg1, arg2, ...)): ...".
Version 0.9.6 provide better ways to handle both casees, bot provided
backward compatibility; version 0.9.8 retracts the compatibility hacks
since they also cause confusing behavior if a function is called with
the wrong number of arguments.

There's a script that helps converting classes that still rely on (b),
provided their methods' first argument is called "self":
demo/scripts/methfix.py.

If this change breaks lots of code you have developed locally, try
#defining COMPAT_HACKS in ceval.c.

(There's a third compatibility hack, which is the reverse of (a): if a
function is defined with two or more arguments, and called with a
single argument that is a tuple with just as many arguments, the items
of this tuple will be used as the arguments. Although this can (and
should!) be done using the built-in function apply() instead, it isn't
withdrawn yet.)

One minor change: comparing instance methods works like expected, so
that if x is an instance of a user-defined class and has a method m,
then (x.m==x.m) yields 1.

The following was already present in 0.9.7beta, but not explicitly
mentioned in the NEWS file: user-defined classes can now define types
that behave in almost allrespects like numbers. See
demo/classes/Rat.py for a simple example.

Changes to the build process
----------------------------

The Configure.py script and the Makefile has been made somewhat more
bullet-proof, after reports of (minor) trouble on certain platforms.

There is now a script to patch Makefile and config.c to add a new
optional built-in module: Addmodule.sh. Read the script before using!

Useing Addmodule.sh, all optional modules can now be configured at
compile time using Configure.py, so there are no modules left that
require dynamic loading.

The Makefile has been fixed to make it easier to use with the VPATH
feature of some Make versions (e.g. SunOS).

Changes affecting portability
-----------------------------

Several minor portability problems have been solved, e.g. "malloc.h"
has been renamed to "mymalloc.h", "strdup.c" is no longer used, and
the system now tolerates malloc(0) returning 0.

For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now
distributed with Python. This solves several minor problems, in
particular scripts invoked using #! can now use dynamic loading.

Changes to the interpreter interface
------------------------------------

On popular demand, there's finally a "profile" feature for interactive
use of the interpreter. If the environment variable $PYTHONSTARTUP is
set to the name of an existing file, Python statements in this file
are executed when the interpreter is started in interactive mode.

There is a new clean-up mechanism, complementing try...finally: if you
assign a function object to sys.exitfunc, it will be called when
Python exits or receives a SIGTERM or SIGHUP signal.

The interpreter is now generally assumed to live in
/usr/local/bin/python (as opposed to /usr/local/python). The script
demo/scripts/fixps.py will update old scripts in place (you can easily
modify it to do other similar changes).

Most I/O that uses sys.stdin/stdout/stderr will now use any object
assigned to those names as long as the object supports readline() or
write() methods.

The parser stack has been increased to 500 to accommodate more
complicated expressions (7 levels used to be the practical maximum,
it's now about 38).

The limit on the size of the *run-time* stack has completely been
removed -- this means that tuple or list displays can contain any
number of elements (formerly more than 50 would crash the
interpreter).

Changes to existing built-in functions and methods
--------------------------------------------------

The built-in functions int(), long(), float(), oct() and hex() now
also apply to class instalces that define corresponding methods
(__int__ etc.).

New built-in functions
----------------------

The new functions str() and repr() convert any object to a string.
The function repr(x) is in all respects equivalent to `x` -- some
people prefer a function for this. The function str(x) does the same
except if x is already a string -- then it returns x unchanged
(repr(x) adds quotes and escapes "funny" characters as octal escapes).

The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y.

Changes to general built-in modules
-----------------------------------

The time module's functions are more general: time() returns a
floating point number and sleep() accepts one. Their accuracies
depends on the precision of the system clock. Millisleep is no longer
needed (although it still exists for now), but millitimer is still
needed since on some systems wall clock time is only available with
seconds precision, while a source of more precise time exists that
isn't synchronized with the wall clock. (On UNIX systems that support
the BSD gettimeofday() function, time.time() is as time.millitimer().)

The string representation of a file object now includes an address:
'<file 'filename', mode 'r' at #######>' where ###### is a hex number
(the object's address) to make it unique.

New functions added to posix: nice(), setpgrp(), and if your system
supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp().

Improvements to the socket module: socket objects have new methods
getpeername() and getsockname(), and the {get,set}sockopt methods can
now get/set any kind of option using strings built with the new struct
module. And there's a new function fromfd() which creates a socket
object given a file descriptor (useful for servers started by inetd,
which have a socket connected to stdin and stdout).

Changes to SGI-specific built-in modules
----------------------------------------

The FORMS library interface (fl) now requires FORMS 2.1a. Some new
functions have been added and some bugs have been fixed.

Additions to al (audio library interface): added getname(),
getdefault() and getminmax().

The gl modules doesn't call "foreground()" when initialized (this
caused some problems) like it dit in 0.9.7beta (but not before).
There's a new gl function 'gversion() which returns a version string.

The interface to sv (Indigo video interface) has totally changed.
(Sorry, still no documentation, but see the examples in
demo/sgi/{sv,video}.)

Changes to standard library modules
-----------------------------------

Most functions in module string are now much faster: they're actually
implemented in C. The module containing the C versions is called
"strop" but you should still import "string" since strop doesn't
provide all the interfaces defined in string (and strop may be renamed
to string when it is complete in a future release).

string.index() now accepts an optional third argument giving an index
where to start searching in the first argument, so you can find second
and further occurrences (this is similar to the regular expression
functions in regex).

The definition of what string.splitfields(anything, '') should return
is changed for the last time: it returns a singleton list containing
its whole first argument unchanged. This is compatible with
regsub.split() which also ignores empty delimiter matches.

posixpath, macpath: added dirname() and normpath() (and basename() to
macpath).

The mainloop module (for use with stdwin) can now demultiplex input
from other sources, as long as they can be polled with select().

New built-in modules
--------------------

Module struct defines functions to pack/unpack values to/from strings
representing binary values in native byte order.

Module strop implements C versions of many functions from string (see
above).

Optional module fcntl defines interfaces to fcntl() and ioctl() --
UNIX only. (Not yet properly documented -- see however src/fcntl.doc.)

Optional module mpz defines an interface to an altaernative long
integer implementation, the GNU MPZ library.

Optional module md5 uses the GNU MPZ library to calculate MD5
signatures of strings.

There are also optional new modules specific to SGI machines: imageop
defines some simple operations to images represented as strings; sv
interfaces to the Indigo video board; cl interfaces to the (yet
unreleased) compression library.

New standard library modules
----------------------------

(Unfortunately the following modules are not all documented; read the
sources to find out more about them!)

autotest: run testall without showing any output unless it differs
from the expected output

bisect: use bisection to insert or find an item in a sorted list

colorsys: defines conversions between various color systems (e.g. RGB
<-> YUV)

nntplib: a client interface to NNTP servers

pipes: utility to construct pipeline from templates, e.g. for
conversion from one file format to another using several utilities.

regsub: contains three functions that are more or less compatible with
awk functions of the same name: sub() and gsub() do string
substitution, split() splits a string using a regular expression to
define how separators are define.

test_types: test operations on the built-in types of Python

toaiff: convert various audio file formats to AIFF format

tzparse: parse the TZ environment parameter (this may be less general
than it could be, let me know if you fix it).

(Note that the obsolete module "path" no longer exists.)

New SGI-specific library modules
--------------------------------

CL: constants for use with the built-in compression library interface (cl)

Queue: a multi-producer, multi-consumer queue class implemented for
use with the built-in thread module

SOCKET: constants for use with built-in module socket, e.g. to set/get
socket options. This is SGI-specific because the constants to be
passed are system-dependent. You can generate a version for your own
system by running the script demo/scripts/h2py.py with
/usr/include/sys/socket.h as input.

cddb: interface to the database used the the CD player

torgb: convert various image file types to rgb format (requires pbmplus)

New demos
---------

There's an experimental interface to define Sun RPC clients and
servers in demo/rpc.

There's a collection of interfaces to WWW, WAIS and Gopher (both
Python classes and program providing a user interface) in demo/www.
This includes a program texi2html.py which converts texinfo files to
HTML files (the format used hy WWW).

The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse.

For SGI systems, there's a whole collection of programs and classes
that make use of the Indigo video board in demo/sgi/{sv,video}. This
represents a significant amount of work that we're giving away!

There are demos "rsa" and "md5test" that exercise the mpz and md5
modules, respectively. The rsa demo is a complete implementation of
the RSA public-key cryptosystem!

A bunch of games and examples submitted by Stoffel Erasmus have been
included in demo/stoffel.

There are miscellaneous new files in some existing demo
subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py,
sgi/al/cmpaf.py, sockets/{mcast,gopher}.py.

There are also many minor changes to existing files, but I'm too lazy
to run a diff and note the differences -- you can do this yourself if
you save the old distribution's demos. One highlight: the
stdwin/python.py demo is much improved!

Changes to the documentation
----------------------------

The LaTeX source for the library uses different macros to enable it to
be converted to texinfo, and from there to INFO or HTML format so it
can be browsed as a hypertext. The net result is that you can now
read the Python library documentation in Emacs info mode!

Changes to the source code that affect C extension writers
----------------------------------------------------------

The function strdup() no longer exists (it was used only in one places
and is somewhat of a a portability problem sice some systems have the
same function in their C library.

The functions NEW() and RENEW() allocate one spare byte to guard
against a NULL return from malloc(0) being taken for an error, but
this should not be relied upon.

==================================
==> NEWS FOR RELEASE 0.9.7beta <==
==================================

Changes to the language proper
------------------------------

User-defined classes can now implement operations invoked through
special syntax, such as x[i] or `x` by defining methods named
__getitem__(self, i) or __repr__(self), etc.

Changes to the build process
----------------------------

Instead of extensive manual editing of the Makefile to select
compile-time options, you can now run a Configure.py script.
The Makefile as distributed builds a minimal interpreter sufficient to
run Configure.py. See also misc/BUILD

The Makefile now includes more "utility" targets, e.g. install and
tags/TAGS

Using the provided strtod.c and strtol.c are now separate options, as
on the Sun the provided strtod.c dumps core :-(

The regex module is now an option chosen by the Makefile, since some
(old) C compilers choke on regexpr.c

Changes affecting portability
-----------------------------

You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin
interface

Dynamic loading is now supported for Sun (and other non-COFF systems)
throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's
DL is out, 1.4)

The system-dependent code for the use of the select() system call is
moved to one file: myselect.h

Thanks to Jaap Vermeulen, the code should now port cleanly to the
SEQUENT

Changes to the interpreter interface
------------------------------------

The interpretation of $PYTHONPATH in the environment is different: it
is inserted in front of the default path instead of overriding it

Changes to existing built-in functions and methods
--------------------------------------------------

List objects now support an optional argument to their sort() method,
which is a comparison function similar to qsort(3) in C

File objects now have a method fileno(), used by the new select module
(see below)

New built-in function
---------------------

coerce(x, y): take two numbers and return a tuple containing them
both converted to a common type

Changes to built-in modules
---------------------------

sys: fixed core dumps in settrace() and setprofile()

socket: added socket methods setsockopt() and getsockopt(); and
fileno(), used by the new select module (see below)

stdwin: added fileno() == connectionnumber(), in support of new module
select (see below)

posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function.

gl: added qgetfd()

fl: added several new functions, fixed several obscure bugs, adapted
to FORMS 2.1

Changes to standard modules
---------------------------

posixpath: changed implementation of ismount()

string: atoi() no longer mistakes leading zero for octal number

...

New built-in modules
--------------------

Modules marked "dynamic only" are not configured at compile time but
can be loaded dynamically. You need to turn on the DL or DLD option in
the Makefile for support dynamic loading of modules (this requires
external code).

select: interfaces to the BSD select() system call

dbm: interfaces to the (new) dbm library (dynamic only)

nis: interfaces to some NIS functions (aka yellow pages)

thread: limited form of multiple threads (sgi only)

audioop: operations useful for audio programs, e.g. u-LAW and ADPCM
coding (dynamic only)

cd: interface to Indigo SCSI CDROM player audio library (sgi only)

jpeg: read files in JPEG format (dynamic only, sgi only; needs
external code)

imgfile: read SGI image files (dynamic only, sgi only)

sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only)

sv: interface to Indigo video library (sgi only)

pc: a minimal set of MS-DOS interfaces (MS-DOS only)

rotor: encryption, by Lance Ellinghouse (dynamic only)

New standard modules
--------------------

Not all these modules are documented. Read the source:
lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains
additional documentation.

imghdr: recognizes image file headers

sndhdr: recognizes sound file headers

profile: print run-time statistics of Python code

readcd, cdplayer: companion modules for built-in module cd (sgi only)

emacs: interface to Emacs using py-connect.el (see below).

SOCKET: symbolic constant definitions for socket options

SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only)

SV: symbolic constat definitions for sv (sgi only)

CD: symbolic constat definitions for cd (sgi only)

New demos
---------

scripts/pp.py: execute Python as a filter with a Perl-like command
line interface

classes/: examples using the new class features

threads/: examples using the new thread module

sgi/cd/: examples using the new cd module

Changes to the documentation
----------------------------

The last-minute syntax changes of release 0.9.6 are now reflected
everywhere in the manuals

The reference manual has a new section (3.2) on implementing new kinds
of numbers, sequences or mappings with user classes

Classes are now treated extensively in the tutorial (chapter 9)

Slightly restructured the system-dependent chapters of the library
manual

The file misc/EXTENDING incorporates documentation for mkvalue() and
a new section on error handling

The files misc/CLASSES and misc/ERRORS are no longer necessary

The doc/Makefile now creates PostScript files automatically

Miscellaneous changes
---------------------

Incorporated Tim Peters' changes to python-mode.el, it's now version
1.06

A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python
program running in an Emacs buffer execute Emacs lisp code. The
necessary Python code is in lib/emacs.py. The Emacs code is
misc/py-connect.el (it needs some external Emacs lisp code)

Changes to the source code that affect C extension writers
----------------------------------------------------------

New service function mkvalue() to construct a Python object from C
values according to a "format" string a la getargs()

Most functions from pythonmain.c moved to new pythonrun.c which is
in libpython.a. This should make embedded versions of Python easier

ceval.h is split in eval.h (which needs compile.h and only declares
eval_code) and ceval.h (which doesn't need compile.hand declares the
rest)

ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to
improve the parallellism of multi-threaded programs by letting other
Python code run when a blocking system call or something similar is
made)

In structmember.[ch], new member types BYTE, CHAR and unsigned
variants have been added

New file xxmodule.c is a template for new extension modules.