blob: 59e67afd2792745b792ce51780bc1cf9c399809c [file] [log] [blame]
Guido van Rossuma7925f11994-01-26 10:20:16 +00001Python history
2--------------
3
Guido van Rossum439d1fa1998-12-21 21:41:14 +00004This file contains the release messages for previous Python releases.
5As you read on you go back to the dark ages of Python's history.
6
7
8======================================================================
9
10
11From 1.5 to 1.5.1
12=================
13
14General
15-------
16
17- The documentation is now unbundled. It has also been extensively
18modified (mostly to implement a new and more uniform formatting
19style). We figure that most people will prefer to download one of the
20preformatted documentation sets (HTML, PostScript or PDF) and that
21only a minority have a need for the LaTeX or FrameMaker sources. Of
22course, the unbundled documentation sources still released -- just not
23in the same archive file, and perhaps not on the same date.
24
25- All bugs noted on the errors page (and many unnoted) are fixed. All
26new bugs take their places.
27
28- No longer a core dump when attempting to print (or repr(), or str())
29a list or dictionary that contains an instance of itself; instead, the
30recursive entry is printed as [...] or {...}. See Py_ReprEnter() and
31Py_ReprLeave() below. Comparisons of such objects still go beserk,
32since this requires a different kind of fix; fortunately, this is a
33less common scenario in practice.
34
35Syntax change
36-------------
37
38- The raise statement can now be used without arguments, to re-raise
39a previously set exception. This should be used after catching an
40exception with an except clause only, either in the except clause or
41later in the same function.
42
43Import and module handling
44--------------------------
45
46- The implementation of import has changed to use a mutex (when
47threading is supported). This means that when two threads
48simultaneously import the same module, the import statements are
49serialized. Recursive imports are not affected.
50
51- Rewrote the finalization code almost completely, to be much more
52careful with the order in which modules are destroyed. Destructors
53will now generally be able to reference built-in names such as None
54without trouble.
55
56- Case-insensitive platforms such as Mac and Windows require the case
57of a module's filename to match the case of the module name as
58specified in the import statement (see below).
59
60- The code for figuring out the default path now distinguishes between
61files, modules, executable files, and directories. When expecting a
62module, we also look for the .pyc or .pyo file.
63
64Parser/tokenizer changes
65------------------------
66
67- The tokenizer can now warn you when your source code mixes tabs and
68spaces for indentation in a manner that depends on how much a tab is
69worth in spaces. Use "python -t" or "python -v" to enable this
70option. Use "python -tt" to turn the warnings into errors. (See also
71tabnanny.py and tabpolice.py below.)
72
73- Return unsigned characters from tok_nextc(), so '\377' isn't
74mistaken for an EOF character.
75
76- Fixed two pernicious bugs in the tokenizer that only affected AIX.
77One was actually a general bug that was triggered by AIX's smaller I/O
78buffer size. The other was a bug in the AIX optimizer's loop
79unrolling code; swapping two statements made the problem go away.
80
81Tools, demos and miscellaneous files
82------------------------------------
83
84- There's a new version of Misc/python-mode.el (the Emacs mode for
85Python) which is much smarter about guessing the indentation style
86used in a particular file. Lots of other cool features too!
87
88- There are two new tools in Tools/scripts: tabnanny.py and
89tabpolice.py, implementing two different ways of checking whether a
90file uses indentation in a way that is sensitive to the interpretation
91of a tab. The preferred module is tabnanny.py (by Tim Peters).
92
93- Some new demo programs:
94
95 Demo/tkinter/guido/paint.py -- Dave Mitchell
96 Demo/sockets/unixserver.py -- Piet van Oostrum
97
98
99- Much better freeze support. The freeze script can now freeze
100hierarchical module names (with a corresponding change to import.c),
101and has a few extra options (e.g. to suppress freezing specific
102modules). It also does much more on Windows NT.
103
104- Version 1.0 of the faq wizard is included (only very small changes
105since version 0.9.0).
106
107- New feature for the ftpmirror script: when removing local files
108(i.e., only when -r is used), do a recursive delete.
109
110Configuring and building Python
111-------------------------------
112
113- Get rid of the check for -linet -- recent Sequent Dynix systems don't
114need this any more and apparently it screws up their configuration.
115
116- Some changes because gcc on SGI doesn't support '-all'.
117
118- Changed the build rules to use $(LIBRARY) instead of
119 -L.. -lpython$(VERSION)
120since the latter trips up the SunOS 4.1.x linker (sigh).
121
122- Fix the bug where the '# dgux is broken' comment in the Makefile
123tripped over Make on some platforms.
124
125- Changes for AIX: install the python.exp file; properly use
126$(srcdir); the makexp_aix script now removes C++ entries of the form
127Class::method.
128
129- Deleted some Makefile targets only used by the (long obsolete)
130gMakefile hacks.
131
132Extension modules
133-----------------
134
135- Performance and threading improvements to the socket and bsddb
136modules, by Christopher Lindblad of Infoseek.
137
138- Added operator.__not__ and operator.not_.
139
140- In the thread module, when a thread exits due to an unhandled
141exception, don't store the exception information in sys.last_*; it
142prevents proper calling of destructors of local variables.
143
144- Fixed a number of small bugs in the cPickle module.
145
146- Changed find() and rfind() in the strop module so that
147find("x","",2) returns -1, matching the implementation in string.py.
148
149- In the time module, be more careful with the result of ctime(), and
150test for HAVE_MKTIME before usinmg mktime().
151
152- Doc strings contributed by Mitch Chapman to the termios, pwd, gdbm
153modules.
154
155- Added the LOG_SYSLOG constant to the syslog module, if defined.
156
157Standard library modules
158------------------------
159
160- All standard library modules have been converted to an indentation
161style using either only tabs or only spaces -- never a mixture -- if
162they weren't already consistent according to tabnanny. This means
163that the new -t option (see above) won't complain about standard
164library modules.
165
166- New standard library modules:
167
168 threading -- GvR and the thread-sig
169 Java style thread objects -- USE THIS!!!
170
171 getpass -- Piers Lauder
172 simple utilities to prompt for a password and to
173 retrieve the current username
174
175 imaplib -- Piers Lauder
176 interface for the IMAP4 protocol
177
178 poplib -- David Ascher, Piers Lauder
179 interface for the POP3 protocol
180
181 smtplib -- Dragon De Monsyne
182 interface for the SMTP protocol
183
184- Some obsolete modules moved to a separate directory (Lib/lib-old)
185which is *not* in the default module search path:
186
187 Para
188 addpack
189 codehack
190 fmt
191 lockfile
192 newdir
193 ni
194 rand
195 tb
196
197- New version of the PCRE code (Perl Compatible Regular Expressions --
198the re module and the supporting pcre extension) by Andrew Kuchling.
199Incompatible new feature in re.sub(): the handling of escapes in the
200replacement string has changed.
201
202- Interface change in the copy module: a __deepcopy__ method is now
203called with the memo dictionary as an argument.
204
205- Feature change in the tokenize module: differentiate between NEWLINE
206token (an official newline) and NL token (a newline that the grammar
207ignores).
208
209- Several bugfixes to the urllib module. It is now truly thread-safe,
210and several bugs and a portability problem have been fixed. New
211features, all due to Sjoerd Mullender: When creating a temporary file,
212it gives it an appropriate suffix. Support the "data:" URL scheme.
213The open() method uses the tempcache.
214
215- New version of the xmllib module (this time with a test suite!) by
216Sjoerd Mullender.
217
218- Added debugging code to the telnetlib module, to be able to trace
219the actual traffic.
220
221- In the rfc822 module, added support for deleting a header (still no
222support for adding headers, though). Also fixed a bug where an
223illegal address would cause a crash in getrouteaddr(), fixed a
224sign reversal in mktime_tz(), and use the local timezone by default
225(the latter two due to Bill van Melle).
226
227- The normpath() function in the dospath and ntpath modules no longer
228does case normalization -- for that, use the separate function
229normcase() (which always existed); normcase() has been sped up and
230fixed (it was the cause of a crash in Mark Hammond's installer in
231certain locales).
232
233- New command supported by the ftplib module: rmd(); also fixed some
234minor bugs.
235
236- The profile module now uses a different timer function by default --
237time.clock() is generally better than os.times(). This makes it work
238better on Windows NT, too.
239
240- The tempfile module now recovers when os.getcwd() raises an
241exception.
242
243- Fixed some bugs in the random module; gauss() was subtly wrong, and
244vonmisesvariate() should return a full circle. Courtesy Mike Miller,
245Lambert Meertens (gauss()), and Magnus Kessler (vonmisesvariate()).
246
247- Better default seed in the whrandom module, courtesy Andrew Kuchling.
248
249- Fix slow close() in shelve module.
250
251- The Unix mailbox class in the mailbox module is now more robust when
252a line begins with the string "From " but is definitely not the start
253of a new message. The pattern used can be changed by overriding a
254method or class variable.
255
256- Added a rmtree() function to the copy module.
257
258- Fixed several typos in the pickle module. Also fixed problems when
259unpickling in restricted execution environments.
260
261- Added docstrings and fixed a typo in the py_compile and compileall
262modules. At Mark Hammond's repeated request, py_compile now append a
263newline to the source if it needs one. Both modules support an extra
264parameter to specify the purported source filename (to be used in
265error messages).
266
267- Some performance tweaks by Jeremy Hylton to the gzip module.
268
269- Fixed a bug in the merge order of dictionaries in the ConfigParser
270module. Courtesy Barry Warsaw.
271
272- In the multifile module, support the optional second parameter to
273seek() when possible.
274
275- Several fixes to the gopherlib module by Lars Marius Garshol. Also,
276urlparse now correctly handles Gopher URLs with query strings.
277
278- Fixed a tiny bug in format_exception() in the traceback module.
279Also rewrite tb_lineno() to be compatible with JPython (and not
280disturb the current exception!); by Jim Hugunin.
281
282- The httplib module is more robust when servers send a short response
283-- courtesy Tim O'Malley.
284
285Tkinter and friends
286-------------------
287
288- Various typos and bugs fixed.
289
290- New module Tkdnd implements a drag-and-drop protocol (within one
291application only).
292
293- The event_*() widget methods have been restructured slightly -- they
294no longer use the default root.
295
296- The interfaces for the bind*() and unbind() widget methods have been
297redesigned; the bind*() methods now return the name of the Tcl command
298created for the callback, and this can be passed as a optional
299argument to unbind() in order to delete the command (normally, such
300commands are automatically unbound when the widget is destroyed, but
301for some applications this isn't enough).
302
303- Variable objects now have trace methods to interface to Tcl's
304variable tracing facilities.
305
306- Image objects now have an optional keyword argument, 'master', to
307specify a widget (tree) to which they belong. The image_names() and
308image_types() calls are now also widget methods.
309
310- There's a new global call, Tkinter.NoDefaultRoot(), which disables
311all use of the default root by the Tkinter library. This is useful to
312debug applications that are in the process of being converted from
313relying on the default root to explicit specification of the root
314widget.
315
316- The 'exit' command is deleted from the Tcl interpreter, since it
317provided a loophole by which one could (accidentally) exit the Python
318interpreter without invoking any cleanup code.
319
320- Tcl_Finalize() is now registered as a Python low-level exit handle,
321so Tcl will be finalized when Python exits.
322
323The Python/C API
324----------------
325
326- New function PyThreadState_GetDict() returns a per-thread dictionary
327intended for storing thread-local global variables.
328
329- New functions Py_ReprEnter() and Py_ReprLeave() use the per-thread
330dictionary to allow recursive container types to detect recursion in
331their repr(), str() and print implementations.
332
333- New function PyObject_Not(x) calculates (not x) according to Python's
334standard rules (basically, it negates the outcome PyObject_IsTrue(x).
335
336- New function _PyModule_Clear(), which clears a module's dictionary
337carefully without removing the __builtins__ entry. This is implied
338when a module object is deallocated (this used to clear the dictionary
339completely).
340
341- New function PyImport_ExecCodeModuleEx(), which extends
342PyImport_ExecCodeModule() by adding an extra parameter to pass it the
343true file.
344
345- New functions Py_GetPythonHome() and Py_SetPythonHome(), intended to
346allow embedded applications to force a different value for PYTHONHOME.
347
348- New global flag Py_FrozenFlag is set when this is a "frozen" Python
349binary; it suppresses warnings about not being able to find the
350standard library directories.
351
352- New global flag Py_TabcheckFlag is incremented by the -t option and
353causes the tokenizer to issue warnings or errors about inconsistent
354mixing of tabs and spaces for indentation.
355
356Miscellaneous minor changes and bug fixes
357-----------------------------------------
358
359- Improved the error message when an attribute of an attribute-less
360object is requested -- include the name of the attribute and the type
361of the object in the message.
362
363- Sped up int(), long(), float() a bit.
364
365- Fixed a bug in list.sort() that would occasionally dump core.
366
367- Fixed a bug in PyNumber_Power() that caused numeric arrays to fail
368when taken tothe real power.
369
370- Fixed a number of bugs in the file reading code, at least one of
371which could cause a core dump on NT, and one of which would
372occasionally cause file.read() to return less than the full contents
373of the file.
374
375- Performance hack by Vladimir Marangozov for stack frame creation.
376
377- Make sure setvbuf() isn't used unless HAVE_SETVBUF is defined.
378
379Windows 95/NT
380-------------
381
382- The .lib files are now part of the distribution; they are collected
383in the subdirectory "libs" of the installation directory.
384
385- The extension modules (.pyd files) are now collected in a separate
386subdirectory of the installation directory named "DLLs".
387
388- The case of a module's filename must now match the case of the
389module name as specified in the import statement. This is an
390experimental feature -- if it turns out to break in too many
391situations, it will be removed (or disabled by default) in the future.
392It can be disabled on a per-case basis by setting the environment
393variable PYTHONCASEOK (to any value).
394
395
396======================================================================
397
398
399From 1.5b2 to 1.5
400=================
401
402- Newly documentated module: BaseHTTPServer.py, thanks to Greg Stein.
403
404- Added doc strings to string.py, stropmodule.c, structmodule.c,
405thanks to Charles Waldman.
406
407- Many nits fixed in the manuals, thanks to Fred Drake and many others
408(especially Rob Hooft and Andrew Kuchling). The HTML version now uses
409HTML markup instead of inline GIF images for tables; only two images
410are left (for obsure bits of math). The index of the HTML version has
411also been much improved. Finally, it is once again possible to
412generate an Emacs info file from the library manual (but I don't
413commit to supporting this in future versions).
414
415- New module: telnetlib.py (a simple telnet client library).
416
417- New tool: Tools/versioncheck/, by Jack Jansen.
418
419- Ported zlibmodule.c and bsddbmodule.c to NT; The project file for MS
420DevStudio 5.0 now includes new subprojects to build the zlib and bsddb
421extension modules.
422
423- Many small changes again to Tkinter.py -- mostly bugfixes and adding
424missing routines. Thanks to Greg McFarlane for reporting a bunch of
425problems and proofreading my fixes.
426
427- The re module and its documentation are up to date with the latest
428version released to the string-sig (Dec. 22).
429
430- Stop test_grp.py from failing when the /etc/group file is empty
431(yes, this happens!).
432
433- Fix bug in integer conversion (mystrtoul.c) that caused
4344294967296==0 to be true!
435
436- The VC++ 4.2 project file should be complete again.
437
438- In tempfile.py, use a better template on NT, and add a new optional
439argument "suffix" with default "" to specify a specific extension for
440the temporary filename (needed sometimes on NT but perhaps also handy
441elsewhere).
442
443- Fixed some bugs in the FAQ wizard, and converted it to use re
444instead of regex.
445
446- Fixed a mysteriously undetected error in dlmodule.c (it was using a
447totally bogus routine name to raise an exception).
448
449- Fixed bug in import.c which wasn't using the new "dos-8x3" name yet.
450
451- Hopefully harmless changes to the build process to support shared
452libraries on DG/UX. This adds a target to create
453libpython$(VERSION).so; however this target is *only* for DG/UX.
454
455- Fixed a bug in the new format string error checking in getargs.c.
456
457- A simple fix for infinite recursion when printing __builtins__:
458reset '_' to None before printing and set it to the printed variable
459*after* printing (and only when printing is successful).
460
461- Fixed lib-tk/SimpleDialog.py to keep the dialog visible even if the
462parent window is not (Skip Montanaro).
463
464- Fixed the two most annoying problems with ftp URLs in
465urllib.urlopen(); an empty file now correctly raises an error, and it
466is no longer required to explicitly close the returned "file" object
467before opening another ftp URL to the same host and directory.
468
469
470======================================================================
471
472
473From 1.5b1 to 1.5b2
474===================
475
476- Fixed a bug in cPickle.c that caused it to crash right away because
477the version string had a different format.
478
479- Changes in pickle.py and cPickle.c: when unpickling an instance of a
480class that doesn't define the __getinitargs__() method, the __init__()
481constructor is no longer called. This makes a much larger group of
482classes picklable by default, but may occasionally change semantics.
483To force calling __init__() on unpickling, define a __getinitargs__()
484method. Other changes too, in particular cPickle now handles classes
485defined in packages correctly. The same change applies to copying
486instances with copy.py. The cPickle.c changes and some pickle.py
487changes are courtesy Jim Fulton.
488
489- Locale support in he "re" (Perl regular expressions) module. Use
490the flag re.L (or re.LOCALE) to enable locale-specific matching
491rules for \w and \b. The in-line syntax for this flag is (?L).
492
493- The built-in function isinstance(x, y) now also succeeds when y is
494a type object and type(x) is y.
495
496- repr() and str() of class and instance objects now reflect the
497package/module in which the class is defined.
498
499- Module "ni" has been removed. (If you really need it, it's been
500renamed to "ni1". Let me know if this causes any problems for you.
501Package authors are encouraged to write __init__.py files that
502support both ni and 1.5 package support, so the same version can be
503used with Python 1.4 as well as 1.5.)
504
505- The thread module is now automatically included when threads are
506configured. (You must remove it from your existing Setup file,
507since it is now in its own Setup.thread file.)
508
509- New command line option "-x" to skip the first line of the script;
510handy to make executable scripts on non-Unix platforms.
511
512- In importdl.c, add the RTLD_GLOBAL to the dlopen() flags. I
513haven't checked how this affects things, but it should make symbols
514in one shared library available to the next one.
515
516- The Windows installer now installs in the "Program Files" folder on
517the proper volume by default.
518
519- The Windows configuration adds a new main program, "pythonw", and
520registers a new extension, ".pyw" that invokes this. This is a
521pstandard Python interpreter that does not pop up a console window;
522handy for pure Tkinter applications. All output to the original
523stdout and stderr is lost; reading from the original stdin yields
524EOF. Also, both python.exe and pythonw.exe now have a pretty icon
525(a green snake in a box, courtesy Mark Hammond).
526
527- Lots of improvements to emacs-mode.el again. See Barry's web page:
528http://www.python.org/ftp/emacs/pmdetails.html.
529
530- Lots of improvements and additions to the library reference manual;
531many by Fred Drake.
532
533- Doc strings for the following modules: rfc822.py, posixpath.py,
534ntpath.py, httplib.py. Thanks to Mitch Chapman and Charles Waldman.
535
536- Some more regression testing.
537
538- An optional 4th (maxsplit) argument to strop.replace().
539
540- Fixed handling of maxsplit in string.splitfields().
541
542- Tweaked os.environ so it can be pickled and copied.
543
544- The portability problems caused by indented preprocessor commands
545and C++ style comments should be gone now.
546
547- In random.py, added Pareto and Weibull distributions.
548
549- The crypt module is now disabled in Modules/Setup.in by default; it
550is rarely needed and causes errors on some systems where users often
551don't know how to deal with those.
552
553- Some improvements to the _tkinter build line suggested by Case Roole.
554
555- A full suite of platform specific files for NetBSD 1.x, submitted by
556Anders Andersen.
557
558- New Solaris specific header STROPTS.py.
559
560- Moved a confusing occurrence of *shared* from the comments in
561Modules/Setup.in (people would enable this one instead of the real
562one, and get disappointing results).
563
564- Changed the default mode for directories to be group-writable when
565the installation process creates them.
566
567- Check for pthread support in "-l_r" for FreeBSD/NetBSD, and support
568shared libraries for both.
569
570- Support FreeBSD and NetBSD in posixfile.py.
571
572- Support for the "event" command, new in Tk 4.2. By Case Roole.
573
574- Add Tix_SafeInit() support to tkappinit.c.
575
576- Various bugs fixed in "re.py" and "pcre.c".
577
578- Fixed a bug (broken use of the syntax table) in the old "regexpr.c".
579
580- In frozenmain.c, stdin is made unbuffered too when PYTHONUNBUFFERED
581is set.
582
583- Provide default blocksize for retrbinary in ftplib.py (Skip
584Montanaro).
585
586- In NT, pick the username up from different places in user.py (Jeff
587Bauer).
588
589- Patch to urlparse.urljoin() for ".." and "..#1", Marc Lemburg.
590
591- Many small improvements to Jeff Rush' OS/2 support.
592
593- ospath.py is gone; it's been obsolete for so many years now...
594
595- The reference manual is now set up to prepare better HTML (still
596using webmaker, alas).
597
598- Add special handling to /Tools/freeze for Python modules that are
599imported implicitly by the Python runtime: 'site' and 'exceptions'.
600
601- Tools/faqwiz 0.8.3 -- add an option to suppress URL processing
602inside <PRE>, by "Scott".
603
604- Added ConfigParser.py, a generic parser for sectioned configuration
605files.
606
607- In _localemodule.c, LC_MESSAGES is not always defined; put it
608between #ifdefs.
609
610- Typo in resource.c: RUSAGE_CHILDERN -> RUSAGE_CHILDREN.
611
612- Demo/scripts/newslist.py: Fix the way the version number is gotten
613out of the RCS revision.
614
615- PyArg_Parse[Tuple] now explicitly check for bad characters at the
616end of the format string.
617
618- Revamped PC/example_nt to support VC++ 5.x.
619
620- <listobject>.sort() now uses a modified quicksort by Raymund Galvin,
621after studying the GNU libg++ quicksort. This should be much faster
622if there are lots of duplicates, and otherwise at least as good.
623
624- Added "uue" as an alias for "uuencode" to mimetools.py. (Hm, the
625uudecode bug where it complaints about trailing garbage is still there
626:-( ).
627
628- pickle.py requires integers in text mode to be in decimal notation
629(it used to accept octal and hex, even though it would only generate
630decimal numbers).
631
632- In string.atof(), don't fail when the "re" module is unavailable.
633Plug the ensueing security leak by supplying an empty __builtins__
634directory to eval().
635
636- A bunch of small fixes and improvements to Tkinter.py.
637
638- Fixed a buffer overrun in PC/getpathp.c.
639
640
641======================================================================
642
643
644From 1.5a4 to 1.5b1
645===================
646
647- The Windows NT/95 installer now includes full HTML of all manuals.
648It also has a checkbox that lets you decide whether to install the
649interpreter and library. The WISE installer script for the installer
650is included in the source tree as PC/python15.wse, and so are the
651icons used for Python files. The config.c file for the Windows build
652is now complete with the pcre module.
653
654- sys.ps1 and sys.ps2 can now arbitrary objects; their str() is
655evaluated for the prompt.
656
657- The reference manual is brought up to date (more or less -- it still
658needs work, e.g. in the area of package import).
659
660- The icons used by latex2html are now included in the Doc
661subdirectory (mostly so that tarring up the HTML files can be fully
662automated). A simple index.html is also added to Doc (it only works
663after you have successfully run latex2html).
664
665- For all you would-be proselytizers out there: a new version of
666Misc/BLURB describes Python more concisely, and Misc/comparisons
667compares Python to several other languages. Misc/BLURB.WINDOWS
668contains a blurb specifically aimed at Windows programmers (by Mark
669Hammond).
670
671- A new version of the Python mode for Emacs is included as
672Misc/python-mode.el. There are too many new features to list here.
673See http://www.python.org/ftp/emacs/pmdetails.html for more info.
674
675- New module fileinput makes iterating over the lines of a list of
676files easier. (This still needs some more thinking to make it more
677extensible.)
678
679- There's full OS/2 support, courtesy Jeff Rush. To build the OS/2
680version, see PC/readme.txt and PC/os2vacpp. This is for IBM's Visual
681Age C++ compiler. I expect that Jeff will also provide a binary
682release for this platform.
683
684- On Linux, the configure script now uses '-Xlinker -export-dynamic'
685instead of '-rdynamic' to link the main program so that it exports its
686symbols to shared libraries it loads dynamically. I hope this doesn't
687break on older Linux versions; it is needed for mklinux and appears to
688work on Linux 2.0.30.
689
690- Some Tkinter resstructuring: the geometry methods that apply to a
691master are now properly usable on toplevel master widgets. There's a
692new (internal) widget class, BaseWidget. New, longer "official" names
693for the geometry manager methods have been added,
694e.g. "grid_columnconfigure()" instead of "columnconfigure()". The old
695shorter names still work, and where there's ambiguity, pack wins over
696place wins over grid. Also, the bind_class method now returns its
697value.
698
699- New, RFC-822 conformant parsing of email addresses and address lists
700in the rfc822 module, courtesy Ben Escoto.
701
702- New, revamped tkappinit.c with support for popular packages (PIL,
703TIX, BLT, TOGL). For the last three, you need to execute the Tcl
704command "load {} Tix" (or Blt, or Togl) to gain access to them.
705The Modules/Setup line for the _tkinter module has been rewritten
706using the cool line-breaking feature of most Bourne shells.
707
708- New socket method connect_ex() returns the error code from connect()
709instead of raising an exception on errors; this makes the logic
710required for asynchronous connects simpler and more efficient.
711
712- New "locale" module with (still experimental) interface to the
713standard C library locale interface, courtesy Martin von Loewis. This
714does not repeat my mistake in 1.5a4 of always calling
715setlocale(LC_ALL, ""). In fact, we've pretty much decided that
716Python's standard numerical formatting operations should always use
717the conventions for the C locale; the locale module contains utility
718functions to format numbers according to the user specified locale.
719(All this is accomplished by an explicit call to setlocale(LC_NUMERIC,
720"C") after locale-changing calls.) See the library manual. (Alas, the
721promised changes to the "re" module for locale support have not been
722materialized yet. If you care, volunteer!)
723
724- Memory leak plugged in Py_BuildValue when building a dictionary.
725
726- Shared modules can now live inside packages (hierarchical module
727namespaces). No changes to the shared module itself are needed.
728
729- Improved policy for __builtins__: this is a module in __main__ and a
730dictionary everywhere else.
731
732- Python no longer catches SIGHUP and SIGTERM by default. This was
733impossible to get right in the light of thread contexts. If you want
734your program to clean up when a signal happens, use the signal module
735to set up your own signal handler.
736
737- New Python/C API PyNumber_CoerceEx() does not return an exception
738when no coercion is possible. This is used to fix a problem where
739comparing incompatible numbers for equality would raise an exception
740rather than return false as in Python 1.4 -- it once again will return
741false.
742
743- The errno module is changed again -- the table of error messages
744(errorstr) is removed. Instead, you can use os.strerror(). This
745removes redundance and a potential locale dependency.
746
747- New module xmllib, to parse XML files. By Sjoerd Mullender.
748
749- New C API PyOS_AfterFork() is called after fork() in posixmodule.c.
750It resets the signal module's notion of what the current process ID
751and thread are, so that signal handlers will work after (and across)
752calls to os.fork().
753
754- Fixed most occurrences of fatal errors due to missing thread state.
755
756- For vgrind (a flexible source pretty printer) fans, there's a simple
757Python definition in Misc/vgrindefs, courtesy Neale Pickett.
758
759- Fixed memory leak in exec statement.
760
761- The test.pystone module has a new function, pystones(loops=LOOPS),
762which returns a (benchtime, stones) tuple. The main() function now
763calls this and prints the report.
764
765- Package directories now *require* the presence of an __init__.py (or
766__init__.pyc) file before they are considered as packages. This is
767done to prevent accidental subdirectories with common names from
768overriding modules with the same name.
769
770- Fixed some strange exceptions in __del__ methods in library modules
771(e.g. urllib). This happens because the builtin names are already
772deleted by the time __del__ is called. The solution (a hack, but it
773works) is to set some instance variables to 0 instead of None.
774
775- The table of built-in module initializers is replaced by a pointer
776variable. This makes it possible to switch to a different table at
777run time, e.g. when a collection of modules is loaded from a shared
778library. (No example code of how to do this is given, but it is
779possible.) The table is still there of course, its name prefixed with
780an underscore and used to initialize the pointer.
781
782- The warning about a thread still having a frame now only happens in
783verbose mode.
784
785- Change the signal finialization so that it also resets the signal
786handlers. After this has been called, our signal handlers are no
787longer active!
788
789- New version of tokenize.py (by Ka-Ping Yee) recognizes raw string
790literals. There's now also a test fort this module.
791
792- The copy module now also uses __dict__.update(state) instead of
793going through individual attribute assignments, for class instances
794without a __setstate__ method.
795
796- New module reconvert translates old-style (regex module) regular
797expressions to new-style (re module, Perl-style) regular expressions.
798
799- Most modules that used to use the regex module now use the re
800module. The grep module has a new pgrep() function which uses
801Perl-style regular expressions.
802
803- The (very old, backwards compatibility) regexp.py module has been
804deleted.
805
806- Restricted execution (rexec): added the pcre module (support for the
807re module) to the list of trusted extension modules.
808
809- New version of Jim Fulton's CObject object type, adds
810PyCObject_FromVoidPtrAndDesc() and PyCObject_GetDesc() APIs.
811
812- Some patches to Lee Busby's fpectl mods that accidentally didn't
813make it into 1.5a4.
814
815- In the string module, add an optional 4th argument to count(),
816matching find() etc.
817
818- Patch for the nntplib module by Charles Waldman to add optional user
819and password arguments to NNTP.__init__(), for nntp servers that need
820them.
821
822- The str() function for class objects now returns
823"modulename.classname" instead of returning the same as repr().
824
825- The parsing of \xXX escapes no longer relies on sscanf().
826
827- The "sharedmodules" subdirectory of the installation is renamed to
828"lib-dynload". (You may have to edit your Modules/Setup file to fix
829this in an existing installation!)
830
831- Fixed Don Beaudry's mess-up with the OPT test in the configure
832script. Certain SGI platforms will still issue a warning for each
833compile; there's not much I can do about this since the compiler's
834exit status doesn't indicate that I was using an obsolete option.
835
836- Fixed Barry's mess-up with {}.get(), and added test cases for it.
837
838- Shared libraries didn't quite work under AIX because of the change
839in status of the GNU readline interface. Fix due to by Vladimir
840Marangozov.
841
842
843======================================================================
844
845
846From 1.5a3 to 1.5a4
847===================
848
849- faqwiz.py: version 0.8; Recognize https:// as URL; <html>...</html>
850feature; better install instructions; removed faqmain.py (which was an
851older version).
852
853- nntplib.py: Fixed some bugs reported by Lars Wirzenius (to Debian)
854about the treatment of lines starting with '.'. Added a minimal test
855function.
856
857- struct module: ignore most whitespace in format strings.
858
859- urllib.py: close the socket and temp file in URLopener.retrieve() so
860that multiple retrievals using the same connection work.
861
862- All standard exceptions are now classes by default; use -X to make
863them strings (for backward compatibility only).
864
865- There's a new standard exception hierarchy, defined in the standard
866library module exceptions.py (which you never need to import
867explicitly). See
868http://grail.cnri.reston.va.us/python/essays/stdexceptions.html for
869more info.
870
871- Three new C API functions:
872
873 - int PyErr_GivenExceptionMatches(obj1, obj2)
874
875 Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
876 instance of type obj2, or of a class derived from obj2
877
878 - int PyErr_ExceptionMatches(obj)
879
880 Higher level wrapper around PyErr_GivenExceptionMatches() which uses
881 PyErr_Occurred() as obj1. This will be the more commonly called
882 function.
883
884 - void PyErr_NormalizeException(typeptr, valptr, tbptr)
885
886 Normalizes exceptions, and places the normalized values in the
887 arguments. If type is not a class, this does nothing. If type is a
888 class, then it makes sure that value is an instance of the class by:
889
890 1. if instance is of the type, or a class derived from type, it does
891 nothing.
892
893 2. otherwise it instantiates the class, using the value as an
894 argument. If value is None, it uses an empty arg tuple, and if
895 the value is a tuple, it uses just that.
896
897- Another new C API function: PyErr_NewException() creates a new
898exception class derived from Exception; when -X is given, it creates a
899new string exception.
900
901- core interpreter: remove the distinction between tuple and list
902unpacking; allow an arbitrary sequence on the right hand side of any
903unpack instruction. (UNPACK_LIST and UNPACK_TUPLE now do the same
904thing, which should really be called UNPACK_SEQUENCE.)
905
906- classes: Allow assignments to an instance's __dict__ or __class__,
907so you can change ivars (including shared ivars -- shock horror) and
908change classes dynamically. Also make the check on read-only
909attributes of classes less draconic -- only the specials names
910__dict__, __bases__, __name__ and __{get,set,del}attr__ can't be
911assigned.
912
913- Two new built-in functions: issubclass() and isinstance(). Both
914take classes as their second arguments. The former takes a class as
915the first argument and returns true iff first is second, or is a
916subclass of second. The latter takes any object as the first argument
917and returns true iff first is an instance of the second, or any
918subclass of second.
919
920- configure: Added configuration tests for presence of alarm(),
921pause(), and getpwent().
922
923- Doc/Makefile: changed latex2html targets.
924
925- classes: Reverse the search order for the Don Beaudry hook so that
926the first class with an applicable hook wins. Makes more sense.
927
928- Changed the checks made in Py_Initialize() and Py_Finalize(). It is
929now legal to call these more than once. The first call to
930Py_Initialize() initializes, the first call to Py_Finalize()
931finalizes. There's also a new API, Py_IsInitalized() which checks
932whether we are already initialized (in case you want to leave things
933as they were).
934
935- Completely disable the declarations for malloc(), realloc() and
936free(). Any 90's C compiler has these in header files, and the tests
937to decide whether to suppress the declarations kept failing on some
938platforms.
939
940- *Before* (instead of after) signalmodule.o is added, remove both
941intrcheck.o and sigcheck.o. This should get rid of warnings in ar or
942ld on various systems.
943
944- Added reop to PC/config.c
945
946- configure: Decided to use -Aa -D_HPUX_SOURCE on HP-UX platforms.
947Removed outdated HP-UX comments from README. Added Cray T3E comments.
948
949- Various renames of statically defined functions that had name
950conflicts on some systems, e.g. strndup (GNU libc), join (Cray),
951roundup (sys/types.h).
952
953- urllib.py: Interpret three slashes in file: URL as local file (for
954Netscape on Windows/Mac).
955
956- copy.py: Make sure the objects returned by __getinitargs__() are
957kept alive (in the memo) to avoid a certain kind of nasty crash. (Not
958easily reproducable because it requires a later call to
959__getinitargs__() to return a tuple that happens to be allocated at
960the same address.)
961
962- Added definition of AR to toplevel Makefile. Renamed @buildno temp
963file to buildno1.
964
965- Moved Include/assert.h to Parser/assert.h, which seems to be the
966only place where it's needed.
967
968- Tweaked the dictionary lookup code again for some more speed
969(Vladimir Marangozov).
970
971- NT build: Changed the way python15.lib is included in the other
972projects. Per Mark Hammond's suggestion, add it to the extra libs in
973Settings instead of to the project's source files.
974
975- regrtest.py: Change default verbosity so that there are only three
976levels left: -q, default and -v. In default mode, the name of each
977test is now printed. -v is the same as the old -vv. -q is more quiet
978than the old default mode.
979
980- Removed the old FAQ from the distribution. You now have to get it
981from the web!
982
983- Removed the PC/make_nt.in file from the distribution; it is no
984longer needed.
985
986- Changed the build sequence so that shared modules are built last.
987This fixes things for AIX and doesn't hurt elsewhere.
988
989- Improved test for GNU MP v1 in mpzmodule.c
990
991- fileobject.c: ftell() on Linux discards all buffered data; changed
992read() code to use lseek() instead to get the same effect
993
994- configure.in, configure, importdl.c: NeXT sharedlib fixes
995
996- tupleobject.c: PyTuple_SetItem asserts refcnt==1
997
998- resource.c: Different strategy regarding whether to declare
999getrusage() and getpagesize() -- #ifdef doesn't work, Linux has
1000conflicting decls in its headers. Choice: only declare the return
1001type, not the argument prototype, and not on Linux.
1002
1003- importdl.c, configure*: set sharedlib extensions properly for NeXT
1004
1005- configure*, Makefile.in, Modules/Makefile.pre.in: AIX shared libraries
1006fixed; moved addition of PURIFY to LINKCC to configure
1007
1008- reopmodule.c, regexmodule.c, regexpr.c, zlibmodule.c: needed casts
1009added to shup up various compilers.
1010
1011- _tkinter.c: removed buggy mac #ifndef
1012
1013- Doc: various Mac documentation changes, added docs for 'ic' module
1014
1015- PC/make_nt.in: deleted
1016
1017- test_time.py, test_strftime.py: tweaks to catch %Z (which may return
1018"")
1019
1020- test_rotor.py: print b -> print `b`
1021
1022- Tkinter.py: (tagOrId) -> (tagOrId,)
1023
1024- Tkinter.py: the Tk class now also has a configure() method and
1025friends (they have been moved to the Misc class to accomplish this).
1026
1027- dict.get(key[, default]) returns dict[key] if it exists, or default
1028if it doesn't. The default defaults to None. This is quicker for
1029some applications than using either has_key() or try:...except
1030KeyError:....
1031
1032- Tools/webchecker/: some small changes to webchecker.py; added
1033websucker.py (a simple web site mirroring script).
1034
1035- Dictionary objects now have a get() method (also in UserDict.py).
1036dict.get(key, default) returns dict[key] if it exists and default
1037otherwise; default defaults to None.
1038
1039- Tools/scripts/logmerge.py: print the author, too.
1040
1041- Changes to import: support for "import a.b.c" is now built in. See
1042http://grail.cnri.reston.va.us/python/essays/packages.html
1043for more info. Most important deviations from "ni.py": __init__.py is
1044executed in the package's namespace instead of as a submodule; and
1045there's no support for "__" or "__domain__". Note that "ni.py" is not
1046changed to match this -- it is simply declared obsolete (while at the
1047same time, it is documented...:-( ).
1048Unfortunately, "ihooks.py" has not been upgraded (but see "knee.py"
1049for an example implementation of hierarchical module import written in
1050Python).
1051
1052- More changes to import: the site.py module is now imported by
1053default when Python is initialized; use -S to disable it. The site.py
1054module extends the path with several more directories: site-packages
1055inside the lib/python1.5/ directory, site-python in the lib/
1056directory, and pathnames mentioned in *.pth files found in either of
1057those directories. See
1058http://grail.cnri.reston.va.us/python/essays/packages.html
1059for more info.
1060
1061- Changes to standard library subdirectory names: those subdirectories
1062that are not packages have been renamed with a hypen in their name,
1063e.g. lib-tk, lib-stdwin, plat-win, plat-linux2, plat-sunos5, dos-8x3.
1064The test suite is now a package -- to run a test, you must now use
1065"import test.test_foo".
1066
1067- A completely new re.py module is provided (thanks to Andrew
1068Kuchling, Tim Peters and Jeffrey Ollie) which uses Philip Hazel's
1069"pcre" re compiler and engine. For a while, the "old" re.py (which
1070was new in 1.5a3!) will be kept around as re1.py. The "old" regex
1071module and underlying parser and engine are still present -- while
1072regex is now officially obsolete, it will probably take several major
1073release cycles before it can be removed.
1074
1075- The posix module now has a strerror() function which translates an
1076error code to a string.
1077
1078- The emacs.py module (which was long obsolete) has been removed.
1079
1080- The universal makefile Misc/Makefile.pre.in now features an
1081"install" target. By default, installed shared libraries go into
1082$exec_prefix/lib/python$VERSION/site-packages/.
1083
1084- The install-sh script is installed with the other configuration
1085specific files (in the config/ subdirectory).
1086
1087- It turns out whatsound.py and sndhdr.py were identical modules.
1088Since there's also an imghdr.py file, I propose to make sndhdr.py the
1089official one. For compatibility, whatsound.py imports * from
1090sndhdr.py.
1091
1092- Class objects have a new attribute, __module__, giving the name of
1093the module in which they were declared. This is useful for pickle and
1094for printing the full name of a class exception.
1095
1096- Many extension modules no longer issue a fatal error when their
1097initialization fails; the importing code now checks whether an error
1098occurred during module initialization, and correctly propagates the
1099exception to the import statement.
1100
1101- Most extension modules now raise class-based exceptions (except when
1102-X is used).
1103
1104- Subtle changes to PyEval_{Save,Restore}Thread(): always swap the
1105thread state -- just don't manipulate the lock if it isn't there.
1106
1107- Fixed a bug in Python/getopt.c that made it do the wrong thing when
1108an option was a single '-'. Thanks to Andrew Kuchling.
1109
1110- New module mimetypes.py will guess a MIME type from a filename's
1111extension.
1112
1113- Windows: the DLL version is now settable via a resource rather than
1114being hardcoded. This can be used for "branding" a binary Python
1115distribution.
1116
1117- urllib.py is now threadsafe -- it now uses re instead of regex, and
1118sys.exc_info() instead of sys.exc_{type,value}.
1119
1120- Many other library modules that used to use
1121sys.exc_{type,value,traceback} are now more thread-safe by virtue of
1122using sys.exc_info().
1123
1124- The functions in popen2 have an optional buffer size parameter.
1125Also, the command argument can now be either a string (passed to the
1126shell) or a list of arguments (passed directly to execv).
1127
1128- Alas, the thread support for _tkinter released with 1.5a3 didn't
1129work. It's been rewritten. The bad news is that it now requires a
1130modified version of a file in the standard Tcl distribution, which you
1131must compile with a -I option pointing to the standard Tcl source
1132tree. For this reason, the thread support is disabled by default.
1133
1134- The errno extension module adds two tables: errorcode maps errno
1135numbers to errno names (e.g. EINTR), and errorstr maps them to
1136message strings. (The latter is redundant because the new call
1137posix.strerror() now does the same, but alla...) (Marc-Andre Lemburg)
1138
1139- The readline extension module now provides some interfaces to
1140internal readline routines that make it possible to write a completer
1141in Python. An example completer, rlcompleter.py, is provided.
1142
1143 When completing a simple identifier, it completes keywords,
1144 built-ins and globals in __main__; when completing
1145 NAME.NAME..., it evaluates (!) the expression up to the last
1146 dot and completes its attributes.
1147
1148 It's very cool to do "import string" type "string.", hit the
1149 completion key (twice), and see the list of names defined by
1150 the string module!
1151
1152 Tip: to use the tab key as the completion key, call
1153
1154 readline.parse_and_bind("tab: complete")
1155
1156- The traceback.py module has a new function tb_lineno() by Marc-Andre
1157Lemburg which extracts the line number from the linenumber table in
1158the code object. Apparently the traceback object doesn't contains the
1159right linenumber when -O is used. Rather than guessing whether -O is
1160on or off, the module itself uses tb_lineno() unconditionally.
1161
1162- Fixed Demo/tkinter/matt/canvas-moving-or-creating.py: change bind()
1163to tag_bind() so it works again.
1164
1165- The pystone script is now a standard library module. Example use:
1166"import test.pystone; test.pystone.main()".
1167
1168- The import of the readline module in interactive mode is now also
1169attempted when -i is specified. (Yes, I know, giving in to Marc-Andre
1170Lemburg, who asked for this. :-)
1171
1172- rfc822.py: Entirely rewritten parseaddr() function by Sjoerd
1173Mullender, to be closer to the standard. This fixes the getaddr()
1174method. Unfortunately, getaddrlist() is as broken as ever, since it
1175splits on commas without regard for RFC 822 quoting conventions.
1176
1177- pprint.py: correctly emit trailing "," in singleton tuples.
1178
1179- _tkinter.c: export names for its type objects, TkappType and
1180TkttType.
1181
1182- pickle.py: use __module__ when defined; fix a particularly hard to
1183reproduce bug that confuses the memo when temporary objects are
1184returned by custom pickling interfaces; and a semantic change: when
1185unpickling the instance variables of an instance, use
1186inst.__dict__.update(value) instead of a for loop with setattr() over
1187the value.keys(). This is more consistent (the pickling doesn't use
1188getattr() either but pickles inst.__dict__) and avoids problems with
1189instances that have a __setattr__ hook. But it *is* a semantic change
1190(because the setattr hook is no longer used). So beware!
1191
1192- config.h is now installed (at last) in
1193$exec_prefix/include/python1.5/. For most sites, this means that it
1194is actually in $prefix/include/python1.5/, with all the other Python
1195include files, since $prefix and $exec_prefix are the same by
1196default.
1197
1198- The imp module now supports parts of the functionality to implement
1199import of hierarchical module names. It now supports find_module()
1200and load_module() for all types of modules. Docstrings have been
1201added for those functions in the built-in imp module that are still
1202relevant (some old interfaces are obsolete). For a sample
1203implementation of hierarchical module import in Python, see the new
1204library module knee.py.
1205
1206- The % operator on string objects now allows arbitrary nested parens
1207in a %(...)X style format. (Brad Howes)
1208
1209- Reverse the order in which Setup and Setup.local are passed to the
1210makesetup script. This allows variable definitions in Setup.local to
1211override definitions in Setup. (But you'll still have to edit Setup
1212if you want to disable modules that are enabled by default, or if such
1213modules need non-standard options.)
1214
1215- Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this
1216is like PyImport_ImporModule(name) but receives the globals and locals
1217dict and the fromlist arguments as well. (The name is a char*; the
1218others are PyObject*s).
1219
1220- The 'p' format in the struct extension module alloded to above is
1221new in 1.5a4.
1222
1223- The types.py module now uses try-except in a few places to make it
1224more likely that it can be imported in restricted mode. Some type
1225names are undefined in that case, e.g. CodeType (inaccessible),
1226FileType (not always accessible), and TracebackType and FrameType
1227(inaccessible).
1228
1229- In urllib.py: added separate administration of temporary files
1230created y URLopener.retrieve() so cleanup() can properly remove them.
1231The old code removed everything in tempcache which was a bad idea if
1232the user had passed a non-temp file into it. Also, in basejoin(),
1233interpret relative paths starting in "../". This is necessary if the
1234server uses symbolic links.
1235
1236- The Windows build procedure and project files are now based on
1237Microsoft Visual C++ 5.x. The build now takes place in the PCbuild
1238directory. It is much more robust, and properly builds separate Debug
1239and Release versions. (The installer will be added shortly.)
1240
1241- Added casts and changed some return types in regexpr.c to avoid
1242compiler warnings or errors on some platforms.
1243
1244- The AIX build tools for shared libraries now supports VPATH. (Donn
1245Cave)
1246
1247- By default, disable the "portable" multimedia modules audioop,
1248imageop, and rgbimg, since they don't work on 64-bit platforms.
1249
1250- Fixed a nasty bug in cStringIO.c when code was actually using the
1251close() method (the destructors would try to free certain fields a
1252second time).
1253
1254- For those who think they need it, there's a "user.py" module. This
1255is *not* imported by default, but can be imported to run user-specific
1256setup commands, ~/.pythonrc.py.
1257
1258- Various speedups suggested by Fredrik Lundh, Marc-Andre Lemburg,
1259Vladimir Marangozov, and others.
1260
1261- Added os.altsep; this is '/' on DOS/Windows, and None on systems
1262with a sane filename syntax.
1263
1264- os.py: Write out the dynamic OS choice, to avoid exec statements.
1265Adding support for a new OS is now a bit more work, but I bet that
1266'dos' or 'nt' will cover most situations...
1267
1268- The obsolete exception AccessError is now really gone.
1269
1270- Tools/faqwiz/: New installation instructions show how to maintain
1271multiple FAQs. Removed bootstrap script from end of faqwiz.py module.
1272Added instructions to bootstrap script, too. Version bumped to 0.8.1.
1273Added <html>...</html> feature suggested by Skip Montanaro. Added
1274leading text for Roulette, default to 'Hit Reload ...'. Fix typo in
1275default SRCDIR.
1276
1277- Documentation for the relatively new modules "keyword" and "symbol"
1278has been added (to the end of the section on the parser extension
1279module).
1280
1281- In module bisect.py, but functions have two optional argument 'lo'
1282and 'hi' which allow you to specify a subsequence of the array to
1283operate on.
1284
1285- In ftplib.py, changed most methods to return their status (even when
1286it is always "200 OK") rather than swallowing it.
1287
1288- main() now calls setlocale(LC_ALL, ""), if setlocale() and
1289<locale.h> are defined.
1290
1291- Changes to configure.in, the configure script, and both
1292Makefile.pre.in files, to support SGI's SGI_ABI platform selection
1293environment variable.
1294
1295
1296======================================================================
1297
1298
1299From 1.4 to 1.5a3
1300=================
1301
1302Security
1303--------
1304
1305- If you are using the setuid script C wrapper (Misc/setuid-prog.c),
1306please use the new version. The old version has a huge security leak.
1307
1308Miscellaneous
1309-------------
1310
1311- Because of various (small) incompatible changes in the Python
1312bytecode interpreter, the magic number for .pyc files has changed
1313again.
1314
1315- The default module search path is now much saner. Both on Unix and
1316Windows, it is essentially derived from the path to the executable
1317(which can be overridden by setting the environment variable
1318$PYTHONHOME). The value of $PYTHONPATH on Windows is now inserted in
1319front of the default path, like in Unix (instead of overriding the
1320default path). On Windows, the directory containing the executable is
1321added to the end of the path.
1322
1323- A new version of python-mode.el for Emacs has been included. Also,
1324a new file ccpy-style.el has been added to configure Emacs cc-mode for
1325the preferred style in Python C sources.
1326
1327- On Unix, when using sys.argv[0] to insert the script directory in
1328front of sys.path, expand a symbolic link. You can now install a
1329program in a private directory and have a symbolic link to it in a
1330public bin directory, and it will put the private directory in the
1331module search path. Note that the symlink is expanded in sys.path[0]
1332but not in sys.argv[0], so you can still tell the name by which you
1333were invoked.
1334
1335- It is now recommended to use ``#!/usr/bin/env python'' instead of
1336``#!/usr/local/bin/python'' at the start of executable scripts, except
1337for CGI scripts. It has been determined that the use of /usr/bin/env
1338is more portable than that of /usr/local/bin/python -- scripts almost
1339never have to be edited when the Python interpreter lives in a
1340non-standard place. Note that this doesn't work for CGI scripts since
1341the python executable often doesn't live in the HTTP server's default
1342search path.
1343
1344- The silly -s command line option and the corresponding
1345PYTHONSUPPRESS environment variable (and the Py_SuppressPrint global
1346flag in the Python/C API) are gone.
1347
1348- Most problems on 64-bit platforms should now be fixed. Andrew
1349Kuchling helped. Some uncommon extension modules are still not
1350clean (image and audio ops?).
1351
1352- Fixed a bug where multiple anonymous tuple arguments would be mixed up
1353when using the debugger or profiler (reported by Just van Rossum).
1354The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this
1355would print the wrong value when run under the debugger or profiler.
1356
1357- The hacks that the dictionary implementation used to speed up
1358repeated lookups of the same C string were removed; these were a
1359source of subtle problems and don't seem to serve much of a purpose
1360any longer.
1361
1362- All traces of support for the long dead access statement have been
1363removed from the sources.
1364
1365- Plugged the two-byte memory leak in the tokenizer when reading an
1366interactive EOF.
1367
1368- There's a -O option to the interpreter that removes SET_LINENO
1369instructions and assert statements (see below); it uses and produces
1370.pyo files instead of .pyc files. The speedup is only a few percent
1371in most cases. The line numbers are still available in the .pyo file,
1372as a separate table (which is also available in .pyc files). However,
1373the removal of the SET_LINENO instructions means that the debugger
1374(pdb) can't set breakpoints on lines in -O mode. The traceback module
1375contains a function to extract a line number from the code object
1376referenced in a traceback object. In the future it should be possible
1377to write external bytecode optimizers that create better optimized
1378.pyo files, and there should be more control over optimization;
1379consider the -O option a "teaser". Without -O, the assert statement
1380actually generates code that first checks __debug__; if this variable
1381is false, the assertion is not checked. __debug__ is a built-in
1382variable whose value is initialized to track the -O flag (it's true
1383iff -O is not specified). With -O, no code is generated for assert
1384statements, nor for code of the form ``if __debug__: <something>''.
1385Sorry, no further constant folding happens.
1386
1387
1388Performance
1389-----------
1390
1391- It's much faster (almost twice for pystone.py -- see
1392Tools/scripts). See the entry on string interning below.
1393
1394- Some speedup by using separate free lists for method objects (both
1395the C and the Python variety) and for floating point numbers.
1396
1397- Big speedup by allocating frame objects with a single malloc() call.
1398The Python/C API for frames is changed (you shouldn't be using this
1399anyway).
1400
1401- Significant speedup by inlining some common opcodes for common operand
1402types (e.g. i+i, i-i, and list[i]). Fredrik Lundh.
1403
1404- Small speedup by reordering the method tables of some common
1405objects (e.g. list.append is now first).
1406
1407- Big optimization to the read() method of file objects. A read()
1408without arguments now attempts to use fstat to allocate a buffer of
1409the right size; for pipes and sockets, it will fall back to doubling
1410the buffer size. While that the improvement is real on all systems,
1411it is most dramatic on Windows.
1412
1413
1414Documentation
1415-------------
1416
1417- Many new pieces of library documentation were contributed, mostly by
1418Andrew Kuchling. Even cmath is now documented! There's also a
1419chapter of the library manual, "libundoc.tex", which provides a
1420listing of all undocumented modules, plus their status (e.g. internal,
1421obsolete, or in need of documentation). Also contributions by Sue
1422Williams, Skip Montanaro, and some module authors who succumbed to
1423pressure to document their own contributed modules :-). Note that
1424printing the documentation now kills fewer trees -- the margins have
1425been reduced.
1426
1427- I have started documenting the Python/C API. Unfortunately this project
1428hasn't been completed yet. It will be complete before the final release of
1429Python 1.5, though. At the moment, it's better to read the LaTeX source
1430than to attempt to run it through LaTeX and print the resulting dvi file.
1431
1432- The posix module (and hence os.py) now has doc strings! Thanks to Neil
1433Schemenauer. I received a few other contributions of doc strings. In most
1434other places, doc strings are still wishful thinking...
1435
1436
1437Language changes
1438----------------
1439
1440- Private variables with leading double underscore are now a permanent
1441feature of the language. (These were experimental in release 1.4. I have
1442favorable experience using them; I can't label them "experimental"
1443forever.)
1444
1445- There's new string literal syntax for "raw strings". Prefixing a string
1446literal with the letter r (or R) disables all escape processing in the
1447string; for example, r'\n' is a two-character string consisting of a
1448backslash followed by the letter n. This combines with all forms of string
1449quotes; it is actually useful for triple quoted doc strings which might
1450contain references to \n or \t. An embedded quote prefixed with a
1451backslash does not terminate the string, but the backslash is still
1452included in the string; for example, r'\'' is a two-character string
1453consisting of a backslash and a quote. (Raw strings are also
1454affectionately known as Robin strings, after their inventor, Robin
1455Friedrich.)
1456
1457- There's a simple assert statement, and a new exception
1458AssertionError. For example, ``assert foo > 0'' is equivalent to ``if
1459not foo > 0: raise AssertionError''. Sorry, the text of the asserted
1460condition is not available; it would be too complicated to generate
1461code for this (since the code is generated from a parse tree).
1462However, the text is displayed as part of the traceback!
1463
1464- The raise statement has a new feature: when using "raise SomeClass,
1465somevalue" where somevalue is not an instance of SomeClass, it
1466instantiates SomeClass(somevalue). In 1.5a4, if somevalue is an
1467instance of a *derived* class of SomeClass, the exception class raised
1468is set to somevalue.__class__, and SomeClass is ignored after that.
1469
1470- Duplicate keyword arguments are now detected at compile time;
1471f(a=1,a=2) is now a syntax error.
1472
1473
1474Changes to builtin features
1475---------------------------
1476
1477- There's a new exception FloatingPointError (used only by Lee Busby's
1478patches to catch floating point exceptions, at the moment).
1479
1480- The obsolete exception ConflictError (presumably used by the long
1481obsolete access statement) has been deleted.
1482
1483- There's a new function sys.exc_info() which returns the tuple
1484(sys.exc_type, sys.exc_value, sys.exc_traceback) in a thread-safe way.
1485
1486- There's a new variable sys.executable, pointing to the executable file
1487for the Python interpreter.
1488
1489- The sort() methods for lists no longer uses the C library qsort(); I
1490wrote my own quicksort implementation, with lots of help (in the form
1491of a kind of competition) from Tim Peters. This solves a bug in
1492dictionary comparisons on some Solaris versions when Python is built
1493with threads, and makes sorting lists even faster.
1494
1495- The semantics of comparing two dictionaries have changed, to make
1496comparison of unequal dictionaries faster. A shorter dictionary is
1497always considered smaller than a larger dictionary. For dictionaries
1498of the same size, the smallest differing element determines the
1499outcome (which yields the same results as before in this case, without
1500explicit sorting). Thanks to Aaron Watters for suggesting something
1501like this.
1502
1503- The semantics of try-except have changed subtly so that calling a
1504function in an exception handler that itself raises and catches an
1505exception no longer overwrites the sys.exc_* variables. This also
1506alleviates the problem that objects referenced in a stack frame that
1507caught an exception are kept alive until another exception is caught
1508-- the sys.exc_* variables are restored to their previous value when
1509returning from a function that caught an exception.
1510
1511- There's a new "buffer" interface. Certain objects (e.g. strings and
1512arrays) now support the "buffer" protocol. Buffer objects are acceptable
1513whenever formerly a string was required for a write operation; mutable
1514buffer objects can be the target of a read operation using the call
1515f.readinto(buffer). A cool feature is that regular expression matching now
1516also work on array objects. Contribution by Jack Jansen. (Needs
1517documentation.)
1518
1519- String interning: dictionary lookups are faster when the lookup
1520string object is the same object as the key in the dictionary, not
1521just a string with the same value. This is done by having a pool of
1522"interned" strings. Most names generated by the interpreter are now
1523automatically interned, and there's a new built-in function intern(s)
1524that returns the interned version of a string. Interned strings are
1525not a different object type, and interning is totally optional, but by
1526interning most keys a speedup of about 15% was obtained for the
1527pystone benchmark.
1528
1529- Dictionary objects have several new methods; clear() and copy() have
1530the obvious semantics, while update(d) merges the contents of another
1531dictionary d into this one, overriding existing keys. The dictionary
1532implementation file is now called dictobject.c rather than the
1533confusing mappingobject.c.
1534
1535- The intrinsic function dir() is much smarter; it looks in __dict__,
1536__members__ and __methods__.
1537
1538- The intrinsic functions int(), long() and float() can now take a
1539string argument and then do the same thing as string.atoi(),
1540string.atol(), and string.atof(). No second 'base' argument is
1541allowed, and complex() does not take a string (nobody cared enough).
1542
1543- When a module is deleted, its globals are now deleted in two phases.
1544In the first phase, all variables whose name begins with exactly one
1545underscore are replaced by None; in the second phase, all variables
1546are deleted. This makes it possible to have global objects whose
1547destructors depend on other globals. The deletion order within each
1548phase is still random.
1549
1550- It is no longer an error for a function to be called without a
1551global variable __builtins__ -- an empty directory will be provided
1552by default.
1553
1554- Guido's corollary to the "Don Beaudry hook": it is now possible to
1555do metaprogramming by using an instance as a base class. Not for the
1556faint of heart; and undocumented as yet, but basically if a base class
1557is an instance, its class will be instantiated to create the new
1558class. Jim Fulton will love it -- it also works with instances of his
1559"extension classes", since it is triggered by the presence of a
1560__class__ attribute on the purported base class. See
1561Demo/metaclasses/index.html for an explanation and see that directory
1562for examples.
1563
1564- Another change is that the Don Beaudry hook is now invoked when
1565*any* base class is special. (Up to 1.5a3, the *last* special base
1566class is used; in 1.5a4, the more rational choice of the *first*
1567special base class is used.)
1568
1569- New optional parameter to the readlines() method of file objects.
1570This indicates the number of bytes to read (the actual number of bytes
1571read will be somewhat larger due to buffering reading until the end of
1572the line). Some optimizations have also been made to speed it up (but
1573not as much as read()).
1574
1575- Complex numbers no longer have the ".conj" pseudo attribute; use
1576z.conjugate() instead, or complex(z.real, -z.imag). Complex numbers
1577now *do* support the __members__ and __methods__ special attributes.
1578
1579- The complex() function now looks for a __complex__() method on class
1580instances before giving up.
1581
1582- Long integers now support arbitrary shift counts, so you can now
1583write 1L<<1000000, memory permitting. (Python 1.4 reports "outrageous
1584shift count for this.)
1585
1586- The hex() and oct() functions have been changed so that for regular
1587integers, they never emit a minus sign. For example, on a 32-bit
1588machine, oct(-1) now returns '037777777777' and hex(-1) returns
1589'0xffffffff'. While this may seem inconsistent, it is much more
1590useful. (For long integers, a minus sign is used as before, to fit
1591the result in memory :-)
1592
1593- The hash() function computes better hashes for several data types,
1594including strings, floating point numbers, and complex numbers.
1595
1596
1597New extension modules
1598---------------------
1599
1600- New extension modules cStringIO.c and cPickle.c, written by Jim
1601Fulton and other folks at Digital Creations. These are much more
1602efficient than their Python counterparts StringIO.py and pickle.py,
1603but don't support subclassing. cPickle.c clocks up to 1000 times
1604faster than pickle.py; cStringIO.c's improvement is less dramatic but
1605still significant.
1606
1607- New extension module zlibmodule.c, interfacing to the free zlib
1608library (gzip compatible compression). There's also a module gzip.py
1609which provides a higher level interface. Written by Andrew Kuchling
1610and Jeremy Hylton.
1611
1612- New module readline; see the "miscellaneous" section above.
1613
1614- New Unix extension module resource.c, by Jeremy Hylton, provides
1615access to getrlimit(), getrusage(), setrusage(), getpagesize(), and
1616related symbolic constants.
1617
1618- New extension puremodule.c, by Barry Warsaw, which interfaces to the
1619Purify(TM) C API. See also the file Misc/PURIFY.README. It is also
1620possible to enable Purify by simply setting the PURIFY Makefile
1621variable in the Modules/Setup file.
1622
1623
1624Changes in extension modules
1625----------------------------
1626
1627- The struct extension module has several new features to control byte
1628order and word size. It supports reading and writing IEEE floats even
1629on platforms where this is not the native format. It uses uppercase
1630format codes for unsigned integers of various sizes (always using
1631Python long ints for 'I' and 'L'), 's' with a size prefix for strings,
1632and 'p' for "Pascal strings" (with a leading length byte, included in
1633the size; blame Hannu Krosing; new in 1.5a4). A prefix '>' forces
1634big-endian data and '<' forces little-endian data; these also select
1635standard data sizes and disable automatic alignment (use pad bytes as
1636needed).
1637
1638- The array module supports uppercase format codes for unsigned data
1639formats (like the struct module).
1640
1641- The fcntl extension module now exports the needed symbolic
1642constants. (Formerly these were in FCNTL.py which was not available
1643or correct for all platforms.)
1644
1645- The extension modules dbm, gdbm and bsddb now check that the
1646database is still open before making any new calls.
1647
1648- The dbhash module is no more. Use bsddb instead. (There's a third
1649party interface for the BSD 2.x code somewhere on the web; support for
1650bsddb will be deprecated.)
1651
1652- The gdbm module now supports a sync() method.
1653
1654- The socket module now has some new functions: getprotobyname(), and
1655the set {ntoh,hton}{s,l}().
1656
1657- Various modules now export their type object: socket.SocketType,
1658array.ArrayType.
1659
1660- The socket module's accept() method now returns unknown addresses as
1661a tuple rather than raising an exception. (This can happen in
1662promiscuous mode.) Theres' also a new function getprotobyname().
1663
1664- The pthread support for the thread module now works on most platforms.
1665
1666- STDWIN is now officially obsolete. Support for it will eventually
1667be removed from the distribution.
1668
1669- The binascii extension module is now hopefully fully debugged.
1670(XXX Oops -- Fredrik Lundh promised me a uuencode fix that I never
1671received.)
1672
1673- audioop.c: added a ratecv() function; better handling of overflow in
1674add().
1675
1676- posixmodule.c: now exports the O_* flags (O_APPEND etc.). On
1677Windows, also O_TEXT and O_BINARY. The 'error' variable (the
1678exception is raises) is renamed -- its string value is now "os.error",
1679so newbies don't believe they have to import posix (or nt) to catch
1680it when they see os.error reported as posix.error. The execve()
1681function now accepts any mapping object for the environment.
1682
1683- A new version of the al (audio library) module for SGI was
1684contributed by Sjoerd Mullender.
1685
1686- The regex module has a new function get_syntax() which retrieves the
1687syntax setting set by set_syntax(). The code was also sanitized,
1688removing worries about unclean error handling. See also below for its
1689successor, re.py.
1690
1691- The "new" module (which creates new objects of various types) once
1692again has a fully functioning new.function() method. Dangerous as
1693ever! Also, new.code() has several new arguments.
1694
1695- A problem has been fixed in the rotor module: on systems with signed
1696characters, rotor-encoded data was not portable when the key contained
16978-bit characters. Also, setkey() now requires its argument rather
1698than having broken code to default it.
1699
1700- The sys.builtin_module_names variable is now a tuple. Another new
1701variables in sys is sys.executable (the full path to the Python
1702binary, if known).
1703
1704- The specs for time.strftime() have undergone some revisions. It
1705appears that not all format characters are supported in the same way
1706on all platforms. Rather than reimplement it, we note these
1707differences in the documentation, and emphasize the shared set of
1708features. There's also a thorough test set (that occasionally finds
1709problems in the C library implementation, e.g. on some Linuxes),
1710thanks to Skip Montanaro.
1711
1712- The nis module seems broken when used with NIS+; unfortunately
1713nobody knows how to fix it. It should still work with old NIS.
1714
1715
1716New library modules
1717-------------------
1718
1719- New (still experimental) Perl-style regular expression module,
1720re.py, which uses a new interface for matching as well as a new
1721syntax; the new interface avoids the thread-unsafety of the regex
1722interface. This comes with a helper extension reopmodule.c and vastly
1723rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim
1724Peters, and Andrew Kuchling. See the documentation libre.tex. In
17251.5, the old regex module is still fully supported; in the future, it
1726will become obsolete.
1727
1728- New module gzip.py; see zlib above.
1729
1730- New module keyword.py exports knowledge about Python's built-in
1731keywords. (New version by Ka-Ping Yee.)
1732
1733- New module pprint.py (with documentation) which supports
1734pretty-printing of lists, tuples, & dictionaries recursively. By Fred
1735Drake.
1736
1737- New module code.py. The function code.compile_command() can
1738determine whether an interactively entered command is complete or not,
1739distinguishing incomplete from invalid input. (XXX Unfortunately,
1740this seems broken at this moment, and I don't have the time to fix
1741it. It's probably better to add an explicit interface to the parser
1742for this.)
1743
1744- There is now a library module xdrlib.py which can read and write the
1745XDR data format as used by Sun RPC, for example. It uses the struct
1746module.
1747
1748
1749Changes in library modules
1750--------------------------
1751
1752- Module codehack.py is now completely obsolete.
1753
1754- The pickle.py module has been updated to make it compatible with the
1755new binary format that cPickle.c produces. By default it produces the
1756old all-ASCII format compatible with the old pickle.py, still much
1757faster than pickle.py; it will read both formats automatically. A few
1758other updates have been made.
1759
1760- A new helper module, copy_reg.py, is provided to register extensions
1761to the pickling code.
1762
1763- Revamped module tokenize.py is much more accurate and has an
1764interface that makes it a breeze to write code to colorize Python
1765source code. Contributed by Ka-Ping Yee.
1766
1767- In ihooks.py, ModuleLoader.load_module() now closes the file under
1768all circumstances.
1769
1770- The tempfile.py module has a new class, TemporaryFile, which creates
1771an open temporary file that will be deleted automatically when
1772closed. This works on Windows and MacOS as well as on Unix. (Jim
1773Fulton.)
1774
1775- Changes to the cgi.py module: Most imports are now done at the
1776top of the module, which provides a speedup when using ni (Jim
1777Fulton). The problem with file upload to a Windows platform is solved
1778by using the new tempfile.TemporaryFile class; temporary files are now
1779always opened in binary mode (Jim Fulton). The cgi.escape() function
1780now takes an optional flag argument that quotes '"' to '&quot;'. It
1781is now possible to invoke cgi.py from a command line script, to test
1782cgi scripts more easily outside an http server. There's an optional
1783limit to the size of uploads to POST (Skip Montanaro). Added a
1784'strict_parsing' option to all parsing functions (Jim Fulton). The
1785function parse_qs() now uses urllib.unquote() on the name as well as
1786the value of fields (Clarence Gardner). The FieldStorage class now
1787has a __len__() method.
1788
1789- httplib.py: the socket object is no longer closed; all HTTP/1.*
1790responses are now accepted; and it is now thread-safe (by not using
1791the regex module).
1792
1793- BaseHTTPModule.py: treat all HTTP/1.* versions the same.
1794
1795- The popen2.py module is now rewritten using a class, which makes
1796access to the standard error stream and the process id of the
1797subprocess possible.
1798
1799- Added timezone support to the rfc822.py module, in the form of a
1800getdate_tz() method and a parsedate_tz() function; also a mktime_tz().
1801Also added recognition of some non-standard date formats, by Lars
1802Wirzenius, and RFC 850 dates (Chris Lawrence).
1803
1804- mhlib.py: various enhancements, including almost compatible parsing
1805of message sequence specifiers without invoking a subprocess. Also
1806added a createmessage() method by Lars Wirzenius.
1807
1808- The StringIO.StringIO class now supports readline(nbytes). (Lars
1809Wirzenius.) (Of course, you should be using cStringIO for performance.)
1810
1811- UserDict.py supports the new dictionary methods as well.
1812
1813- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to
1814speed it up, and replace 0 seed values by 1 to avoid degeneration.
1815A bug was fixed in the test for invalid arguments.
1816
1817- Module ftplib.py: added support for parsing a .netrc file (Fred
1818Drake). Also added an ntransfercmd() method to the FTP class, which
1819allows access to the expected size of a transfer when available, and a
1820parse150() function to the module which parses the corresponding 150
1821response.
1822
1823- urllib.py: the ftp cache is now limited to 10 entries. Added
1824quote_plus() and unquote_plus() functions which are like quote() and
1825unquote() but also replace spaces with '+' or vice versa, for
1826encoding/decoding CGI form arguments. Catch all errors from the ftp
1827module. HTTP requests now add the Host: header line. The proxy
1828variable names are now mapped to lower case, for Windows. The
1829spliturl() function no longer erroneously throws away all data past
1830the first newline. The basejoin() function now intereprets "../"
1831correctly. I *believe* that the problems with "exception raised in
1832__del__" under certain circumstances have been fixed (mostly by
1833changes elsewher in the interpreter).
1834
1835- In urlparse.py, there is a cache for results in urlparse.urlparse();
1836its size limit is set to 20. Also, new URL schemes shttp, https, and
1837snews are "supported".
1838
1839- shelve.py: use cPickle and cStringIO when available. Also added
1840a sync() method, which calls the database's sync() method if there is
1841one.
1842
1843- The mimetools.py module now uses the available Python modules for
1844decoding quoted-printable, uuencode and base64 formats, rather than
1845creating a subprocess.
1846
1847- The python debugger (pdb.py, and its base class bdb.py) now support
1848conditional breakpoints. See the docs.
1849
1850- The modules base64.py, uu.py and quopri.py can now be used as simple
1851command line utilities.
1852
1853- Various small fixes to the nntplib.py module that I can't bother to
1854document in detail.
1855
1856- Sjoerd Mullender's mimify.py module now supports base64 encoding and
1857includes functions to handle the funny encoding you sometimes see in mail
1858headers. It is now documented.
1859
1860- mailbox.py: Added BabylMailbox. Improved the way the mailbox is
1861gotten from the environment.
1862
1863- Many more modules now correctly open files in binary mode when this
1864is necessary on non-Unix platforms.
1865
1866- The copying functions in the undocumented module shutil.py are
1867smarter.
1868
1869- The Writer classes in the formatter.py module now have a flush()
1870method.
1871
1872- The sgmllib.py module accepts hyphens and periods in the middle of
1873attribute names. While this is against the SGML standard, there is
1874some HTML out there that uses this...
1875
1876- The interface for the Python bytecode disassembler module, dis.py,
1877has been enhanced quite a bit. There's now one main function,
1878dis.dis(), which takes almost any kind of object (function, module,
1879class, instance, method, code object) and disassembles it; without
1880arguments it disassembles the last frame of the last traceback. The
1881other functions have changed slightly, too.
1882
1883- The imghdr.py module recognizes new image types: BMP, PNG.
1884
1885- The string.py module has a new function replace(str, old, new,
1886[maxsplit]) which does substring replacements. It is actually
1887implemented in C in the strop module. The functions [r]find() an
1888[r]index() have an optional 4th argument indicating the end of the
1889substring to search, alsoo implemented by their strop counterparts.
1890(Remember, never import strop -- import string uses strop when
1891available with zero overhead.)
1892
1893- The string.join() function now accepts any sequence argument, not
1894just lists and tuples.
1895
1896- The string.maketrans() requires its first two arguments to be
1897present. The old version didn't require them, but there's not much
1898point without them, and the documentation suggests that they are
1899required, so we fixed the code to match the documentation.
1900
1901- The regsub.py module has a function clear_cache(), which clears its
1902internal cache of compiled regular expressions. Also, the cache now
1903takes the current syntax setting into account. (However, this module
1904is now obsolete -- use the sub() or subn() functions or methods in the
1905re module.)
1906
1907- The undocumented module Complex.py has been removed, now that Python
1908has built-in complex numbers. A similar module remains as
1909Demo/classes/Complex.py, as an example.
1910
1911
1912Changes to the build process
1913----------------------------
1914
1915- The way GNU readline is configured is totally different. The
1916--with-readline configure option is gone. It is now an extension
1917module, which may be loaded dynamically. You must enable it (and
1918specify the correct linraries to link with) in the Modules/Setup file.
1919Importing the module installs some hooks which enable command line
1920editing. When the interpreter shell is invoked interactively, it
1921attempts to import the readline module; when this fails, the default
1922input mechanism is used. The hook variables are PyOS_InputHook and
1923PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with
1924ideas from William Magro.)
1925
1926- New build procedure: a single library, libpython1.5.a, is now built,
1927which contains absolutely everything except for a one-line main()
1928program (which calls Py_Main(argc, argv) to start the interpreter
1929shell). This makes life much simpler for applications that need to
1930embed Python. The serial number of the build is now included in the
1931version string (sys.version).
1932
1933- As far as I can tell, neither gcc -Wall nor the Microsoft compiler
1934emits a single warning any more when compiling Python.
1935
1936- A number of new Makefile variables have been added for special
1937situations, e.g. LDLAST is appended to the link command. These are
1938used by editing the Makefile or passing them on the make command
1939line.
1940
1941- A set of patches from Lee Busby has been integrated that make it
1942possible to catch floating point exceptions. Use the configure option
1943--with-fpectl to enable the patches; the extension modules fpectl and
1944fpetest provide control to enable/disable and test the feature,
1945respectively.
1946
1947- The support for shared libraries under AIX is now simpler and more
1948robust. Thanks to Vladimir Marangozov for revamping his own patches!
1949
1950- The Modules/makesetup script now reads a file Setup.local as well as
1951a file Setup. Most changes to the Setup script can be done by editing
1952Setup.local instead, which makes it easier to carry a particular setup
1953over from one release to the next.
1954
1955- The Modules/makesetup script now copies any "include" lines it
1956encounters verbatim into the output Makefile. It also recognizes .cxx
1957and .cpp as C++ source files.
1958
1959- The configure script is smarter about C compiler options; e.g. with
1960gcc it uses -O2 and -g when possible, and on some other platforms it
1961uses -Olimit 1500 to avoid a warning from the optimizer about the main
1962loop in ceval.c (which has more than 1000 basic blocks).
1963
1964- The configure script now detects whether malloc(0) returns a NULL
1965pointer or a valid block (of length zero). This avoids the nonsense
1966of always adding one byte to all malloc() arguments on most platforms.
1967
1968- The configure script has a new option, --with-dec-threads, to enable
1969DEC threads on DEC Alpha platforms. Also, --with-threads is now an
1970alias for --with-thread (this was the Most Common Typo in configure
1971arguments).
1972
1973- Many changes in Doc/Makefile; amongst others, latex2html is now used
1974to generate HTML from all latex documents.
1975
1976
1977Change to the Python/C API
1978--------------------------
1979
1980- Because some interfaces have changed, the PYTHON_API macro has been
1981bumped. Most extensions built for the old API version will still run,
1982but I can't guarantee this. Python prints a warning message on
1983version mismatches; it dumps core when the version mismatch causes a
1984serious problem :-)
1985
1986- I've completed the Grand Renaming, with the help of Roger Masse and
1987Barry Warsaw. This makes reading or debugging the code much easier.
1988Many other unrelated code reorganizations have also been carried out.
1989The allobjects.h header file is gone; instead, you would have to
1990include Python.h followed by rename2.h. But you're better off running
1991Tools/scripts/fixcid.py -s Misc/RENAME on your source, so you can omit
1992the rename2.h; it will disappear in the next release.
1993
1994- Various and sundry small bugs in the "abstract" interfaces have been
1995fixed. Thanks to all the (involuntary) testers of the Python 1.4
1996version! Some new functions have been added, e.g. PySequence_List(o),
1997equivalent to list(o) in Python.
1998
1999- New API functions PyLong_FromUnsignedLong() and
2000PyLong_AsUnsignedLong().
2001
2002- The API functions in the file cgensupport.c are no longer
2003supported. This file has been moved to Modules and is only ever
2004compiled when the SGI specific 'gl' module is built.
2005
2006- PyObject_Compare() can now raise an exception. Check with
2007PyErr_Occurred(). The comparison function in an object type may also
2008raise an exception.
2009
2010- The slice interface uses an upper bound of INT_MAX when no explicit
2011upper bound is given (e.x. for a[1:]). It used to ask the object for
2012its length and do the calculations.
2013
2014- Support for multiple independent interpreters. See Doc/api.tex,
2015functions Py_NewInterpreter() and Py_EndInterpreter(). Since the
2016documentation is incomplete, also see the new Demo/pysvr example
2017(which shows how to use these in a threaded application) and the
2018source code.
2019
2020- There is now a Py_Finalize() function which "de-initializes"
2021Python. It is possible to completely restart the interpreter
2022repeatedly by calling Py_Finalize() followed by Py_Initialize(). A
2023change of functionality in Py_Initialize() means that it is now a
2024fatal error to call it while the interpreter is already initialized.
2025The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit()
2026is deprecated (it is nothing more than Py_Finalize() followed by
2027exit()).
2028
2029- There are no known memory leaks left. While Py_Finalize() doesn't
2030free *all* allocated memory (some of it is hard to track down),
2031repeated calls to Py_Finalize() and Py_Initialize() do not create
2032unaccessible heap blocks.
2033
2034- There is now explicit per-thread state. (Inspired by, but not the
2035same as, Greg Stein's free threading patches.)
2036
2037- There is now better support for threading C applications. There are
2038now explicit APIs to manipulate the interpreter lock. Read the source
2039or the Demo/pysvr example; the new functions are
2040PyEval_{Acquire,Release}{Lock,Thread}().
2041
2042- The test macro DEBUG has changed to Py_DEBUG, to avoid interference
2043with other libraries' DEBUG macros. Likewise for any other test
2044macros that didn't yet start with Py_.
2045
2046- New wrappers around malloc() and friends: Py_Malloc() etc. call
2047malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call
2048just malloc(). Use of these wrappers could be essential if multiple
2049memory allocators exist (e.g. when using certain DLL setups under
2050Windows). (Idea by Jim Fulton.)
2051
2052- New C API PyImport_Import() which uses whatever __import__() hook
2053that is installed for the current execution environment. By Jim
2054Fulton.
2055
2056- It is now possible for an extension module's init function to fail
2057non-fatally, by calling one of the PyErr_* functions and returning.
2058
2059- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their
2060argument to the proper type, like the similar PyString macros already
2061did. (Suggestion by Marc-Andre Lemburg.) Similar for PyList_GET_SIZE
2062and PyList_GET_ITEM.
2063
2064- Some of the Py_Get* function, like Py_GetVersion() (but not yet
2065Py_GetPath()) are now declared as returning a const char *. (More
2066should follow.)
2067
2068- Changed the run-time library to check for exceptions after object
2069comparisons. PyObject_Compare() can now return an exception; use
2070PyErr_Occurred() to check (there is *no* special return value).
2071
2072- PyFile_WriteString() and Py_Flushline() now return error indicators
2073instead of clearing exceptions. This fixes an obscure bug where using
2074these would clear a pending exception, discovered by Just van Rossum.
2075
2076- There's a new function, PyArg_ParseTupleAndKeywords(), which parses
2077an argument list including keyword arguments. Contributed by Geoff
2078Philbrick.
2079
2080- PyArg_GetInt() is gone.
2081
2082- It's no longer necessary to include graminit.h when calling one of
2083the extended parser API functions. The three public grammar start
2084symbols are now in Python.h as Py_single_input, Py_file_input, and
2085Py_eval_input.
2086
2087- The CObject interface has a new function,
2088PyCObject_Import(module, name). It calls PyCObject_AsVoidPtr()
2089on the object referenced by "module.name".
2090
2091
2092Tkinter
2093-------
2094
2095- On popular demand, _tkinter once again installs a hook for readline
2096that processes certain Tk events while waiting for the user to type
2097(using PyOS_InputHook).
2098
2099- A patch by Craig McPheeters plugs the most obnoxious memory leaks,
2100caused by command definitions referencing widget objects beyond their
2101lifetime.
2102
2103- New standard dialog modules: tkColorChooser.py, tkCommonDialog.py,
2104tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py These interface
2105with the new Tk dialog scripts, and provide more "native platform"
2106style file selection dialog boxes on some platforms. Contributed by
2107Fredrik Lundh.
2108
2109- Tkinter.py: when the first Tk object is destroyed, it sets the
2110hiddel global _default_root to None, so that when another Tk object is
2111created it becomes the new default root. Other miscellaneous
2112changes and fixes.
2113
2114- The Image class now has a configure method.
2115
2116- Added a bunch of new winfo options to Tkinter.py; we should now be
2117up to date with Tk 4.2. The new winfo options supported are:
2118mananger, pointerx, pointerxy, pointery, server, viewable, visualid,
2119visualsavailable.
2120
2121- The broken bind() method on Canvas objects defined in the Canvas.py
2122module has been fixed. The CanvasItem and Group classes now also have
2123an unbind() method.
2124
2125- The problem with Tkinter.py falling back to trying to import
2126"tkinter" when "_tkinter" is not found has been fixed -- it no longer
2127tries "tkinter", ever. This makes diagnosing the problem "_tkinter
2128not configured" much easier and will hopefully reduce the newsgroup
2129traffic on this topic.
2130
2131- The ScrolledText module once again supports the 'cnf' parameter, to
2132be compatible with the examples in Mark Lutz' book (I know, I know,
2133too late...)
2134
2135- The _tkinter.c extension module has been revamped. It now support
2136Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It
2137works well under Windows and Mac (with the latest Tk ports to those
2138platforms). It also supports threading -- it is safe for one
2139(Python-created) thread to be blocked in _tkinter.mainloop() while
2140other threads modify widgets. To make the changes visible, those
2141threads must use update_idletasks()method. (The patch for threading
2142in 1.5a3 was broken; in 1.5a4, it is back in a different version,
2143which requires access to the Tcl sources to get it to work -- hence it
2144is disabled by default.)
2145
2146- A bug in _tkinter.c has been fixed, where Split() with a string
2147containing an unmatched '"' could cause an exception or core dump.
2148
2149- Unfortunately, on Windows and Mac, Tk 8.0 no longer supports
2150CreateFileHandler, so _tkinter.createfilehandler is not available on
2151those platforms when using Tk 8.0 or later. I will have to rethink
2152how to interface with Tcl's lower-level event mechanism, or with its
2153channels (which are like Python's file-like objects). Jack Jansen has
2154provided a fix for the Mac, so createfilehandler *is* actually
2155supported there; maybe I can adapt his fix for Windows.
2156
2157
2158Tools and Demos
2159---------------
2160
2161- A new regression test suite is provided, which tests most of the
2162standard and built-in modules. The regression test is run by invoking
2163the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass;
2164he and Roger Masse contributed most of the new tests.
2165
2166- New tool: faqwiz -- the CGI script that is used to maintain the
2167Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In
2168Tools/faqwiz.
2169
2170- New tool: webchecker -- a simple extensible web robot that, when
2171aimed at a web server, checks that server for dead links. Available
2172are a command line utility as well as a Tkinter based GUI version. In
2173Tools/webchecker. A simplified version of this program is dissected
2174in my article in O'Reilly's WWW Journal, the issue on Scripting
2175Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120).
2176Includes a parser for robots.txt files by Skip Montanaro.
2177
2178- New small tools: cvsfiles.py (prints a list of all files under CVS
2179n a particular directory tree), treesync.py (a rather Guido-specific
2180script to synchronize two source trees, one on Windows NT, the other
2181one on Unix under CVS but accessible from the NT box), and logmerge.py
2182(sort a collection of RCS or CVS logs by date). In Tools/scripts.
2183
2184- The freeze script now also works under Windows (NT). Another
2185feature allows the -p option to be pointed at the Python source tree
2186instead of the installation prefix. This was loosely based on part of
2187xfreeze by Sam Rushing and Bill Tutt.
2188
2189- New examples (Demo/extend) that show how to use the generic
2190extension makefile (Misc/Makefile.pre.in).
2191
2192- Tools/scripts/h2py.py now supports C++ comments.
2193
2194- Tools/scripts/pystone.py script is upgraded to version 1.1; there
2195was a bug in version 1.0 (distributed with Python 1.4) that leaked
2196memory. Also, in 1.1, the LOOPS variable is incremented to 10000.
2197
2198- Demo/classes/Rat.py completely rewritten by Sjoerd Mullender.
2199
2200
2201Windows (NT and 95)
2202-------------------
2203
2204- New project files for Developer Studio (Visual C++) 5.0 for Windows
2205NT (the old VC++ 4.2 Makefile is also still supported, but will
2206eventually be withdrawn due to its bulkiness).
2207
2208- See the note on the new module search path in the "Miscellaneous" section
2209above.
2210
2211- Support for Win32s (the 32-bit Windows API under Windows 3.1) is
2212basically withdrawn. If it still works for you, you're lucky.
2213
2214- There's a new extension module, msvcrt.c, which provides various
2215low-level operations defined in the Microsoft Visual C++ Runtime Library.
2216These include locking(), setmode(), get_osfhandle(), set_osfhandle(), and
2217console I/O functions like kbhit(), getch() and putch().
2218
2219- The -u option not only sets the standard I/O streams to unbuffered
2220status, but also sets them in binary mode. (This can also be done
2221using msvcrt.setmode(), by the way.)
2222
2223- The, sys.prefix and sys.exec_prefix variables point to the directory
2224where Python is installed, or to the top of the source tree, if it was run
2225from there.
2226
2227- The various os.path modules (posixpath, ntpath, macpath) now support
2228passing more than two arguments to the join() function, so
2229os.path.join(a, b, c) is the same as os.path.join(a, os.path.join(b,
2230c)).
2231
2232- The ntpath module (normally used as os.path) supports ~ to $HOME
2233expansion in expanduser().
2234
2235- The freeze tool now works on Windows.
2236
2237- See also the Tkinter category for a sad note on
2238_tkinter.createfilehandler().
2239
2240- The truncate() method for file objects now works on Windows.
2241
2242- Py_Initialize() is no longer called when the DLL is loaded. You
2243must call it yourself.
2244
2245- The time module's clock() function now has good precision through
2246the use of the Win32 API QueryPerformanceCounter().
2247
2248- Mark Hammond will release Python 1.5 versions of PythonWin and his
2249other Windows specific code: the win32api extensions, COM/ActiveX
2250support, and the MFC interface.
2251
2252
2253Mac
2254---
2255
2256- As always, the Macintosh port will be done by Jack Jansen. He will
2257make a separate announcement for the Mac specific source code and the
2258binary distribution(s) when these are ready.
2259
2260
2261======================================================================
Guido van Rossuma7925f11994-01-26 10:20:16 +00002262
Guido van Rossumaa253861994-10-06 17:18:57 +00002263
Guido van Rossumc30e95f1996-07-30 18:53:51 +00002264=====================================
Guido van Rossum821a5581997-05-23 04:05:31 +00002265==> Release 1.4 (October 25 1996) <==
2266=====================================
2267
2268(Starting in reverse chronological order:)
2269
2270- Changed disclaimer notice.
2271
2272- Added SHELL=/bin/sh to Misc/Makefile.pre.in -- some Make versions
2273default to the user's login shell.
2274
2275- In Lib/tkinter/Tkinter.py, removed bogus binding of <Delete> in Text
2276widget, and bogus bspace() function.
2277
2278- In Lib/cgi.py, bumped __version__ to 2.0 and restored a truncated
2279paragraph.
2280
2281- Fixed the NT Makefile (PC/vc40.mak) for VC 4.0 to set /MD for all
2282subprojects, and to remove the (broken) experimental NumPy
2283subprojects.
2284
2285- In Lib/py_compile.py, cast mtime to long() so it will work on Mac
2286(where os.stat() returns mtimes as floats.)
2287- Set self.rfile unbuffered (like self.wfile) in SocketServer.py, to
2288fix POST in CGIHTTPServer.py.
2289
2290- Version 2.83 of Misc/python-mode.el for Emacs is included.
2291
2292- In Modules/regexmodule.c, fixed symcomp() to correctly handle a new
2293group starting immediately after a group tag.
2294
2295- In Lib/SocketServer.py, changed the mode for rfile to unbuffered.
2296
2297- In Objects/stringobject.c, fixed the compare function to do the
2298first char comparison in unsigned mode, for consistency with the way
2299other characters are compared by memcmp().
2300
2301- In Lib/tkinter/Tkinter.py, fixed Scale.get() to support floats.
2302
2303- In Lib/urllib.py, fix another case where openedurl wasn't set.
2304
2305(XXX Sorry, the rest is in totally random order. No time to fix it.)
2306
2307- SyntaxError exceptions detected during code generation
2308(e.g. assignment to an expression) now include a line number.
2309
2310- Don't leave trailing / or \ in script directory inserted in front of
2311sys.path.
2312
2313- Added a note to Tools/scripts/classfix.py abouts its historical
2314importance.
2315
2316- Added Misc/Makefile.pre.in, a universal Makefile for extensions
2317built outside the distribution.
2318
2319- Rewritten Misc/faq2html.py, by Ka-Ping Yee.
2320
2321- Install shared modules with mode 555 (needed for performance on some
2322platforms).
2323
2324- Some changes to standard library modules to avoid calling append()
2325with more than one argument -- while supported, this should be
2326outlawed, and I don't want to set a bad example.
2327
2328- bdb.py (and hence pdb.py) supports calling run() with a code object
2329instead of a code string.
2330
2331- Fixed an embarrassing bug cgi.py which prevented correct uploading
2332of binary files from Netscape (which doesn't distinguish between
2333binary and text files). Also added dormant logging support, which
2334makes it easier to debug the cgi module itself.
2335
2336- Added default writer to constructor of NullFormatter class.
2337
2338- Use binary mode for socket.makefile() calls in ftplib.py.
2339
2340- The ihooks module no longer "installs" itself upon import -- this
2341was an experimental feature that helped ironing out some bugs but that
2342slowed down code that imported it without the need to install it
2343(e.g. the rexec module). Also close the file in some cases and add
2344the __file__ attribute to loaded modules.
2345
2346- The test program for mailbox.py is now more useful.
2347
2348- Added getparamnames() to Message class in mimetools.py -- it returns
2349the names of parameters to the content-type header.
2350
2351- Fixed a typo in ni that broke the loop stripping "__." from names.
2352
2353- Fix sys.path[0] for scripts run via pdb.py's new main program.
2354
2355- profile.py can now also run a script, like pdb.
2356
2357- Fix a small bug in pyclbr -- don't add names starting with _ when
2358emulating from ... import *.
2359
2360- Fixed a series of embarrassing typos in rexec's handling of standard
2361I/O redirection. Added some more "safe" built-in modules: cmath,
2362errno, operator.
2363
2364- Fixed embarrassing typo in shelve.py.
2365
2366- Added SliceType and EllipsisType to types.py.
2367
2368- In urllib.py, added handling for error 301 (same as 302); added
2369geturl() method to get the URL after redirection.
2370
2371- Fixed embarrassing typo in xdrlib.py. Also fixed typo in Setup.in
2372for _xdrmodule.c and removed redundant #include from _xdrmodule.c.
2373
2374- Fixed bsddbmodule.c to add binary mode indicator on platforms that
2375have it. This should make it working on Windows NT.
2376
2377- Changed last uses of #ifdef NT to #ifdef MS_WINDOWS or MS_WIN32,
2378whatever applies. Also rationalized some other tests for various MS
2379platforms.
2380
2381- Added the sources for the NT installer script used for Python
23821.4beta3. Not tested with this release, but better than nothing.
2383
2384- A compromise in pickle's defenses against Trojan horses: a
2385user-defined function is now okay where a class is expected. A
2386built-in function is not okay, to prevent pickling something that
2387will execute os.system("rm -f *") when unpickling.
2388
2389- dis.py will print the name of local variables referenced by local
2390load/store/delete instructions.
2391
2392- Improved portability of SimpleHTTPServer module to non-Unix
2393platform.
2394
2395- The thread.h interface adds an extra argument to down_sema(). This
2396only affects other C code that uses thread.c; the Python thread module
2397doesn't use semaphores (which aren't provided on all platforms where
2398Python threads are supported). Note: on NT, this change is not
2399implemented.
2400
2401- Fixed some typos in abstract.h; corrected signature of
2402PyNumber_Coerce, added PyMapping_DelItem. Also fixed a bug in
2403abstract.c's PyObject_CallMethod().
2404
2405- apply(classname, (), {}) now works even if the class has no
2406__init__() method.
2407
2408- Implemented complex remainder and divmod() (these would dump core!).
2409Conversion of complex numbers to int, long int or float now raises an
2410exception, since there is no meaningful way to do it without losing
2411information.
2412
2413- Fixed bug in built-in complex() function which gave the wrong result
2414for two real arguments.
2415
2416- Change the hash algorithm for strings -- the multiplier is now
24171000003 instead of 3, which gives better spread for short strings.
2418
2419- New default path for Windows NT, the registry structure now supports
2420default paths for different install packages. (Mark Hammond -- the
2421next PythonWin release will use this.)
2422
2423- Added more symbols to the python_nt.def file.
2424
2425- When using GNU readline, set rl_readline_name to "python".
2426
2427- The Ellipses built-in name has been renamed to Ellipsis -- this is
2428the correct singular form. Thanks to Ka-Ping Yee, who saved us from
2429eternal embarrassment.
2430
2431- Bumped the PYTHON_API_VERSION to 1006, due to the Ellipses ->
2432Ellipsis name change.
2433
2434- Updated the library reference manual. Added documentation of
2435restricted mode (rexec, Bastion) and the formatter module (for use
2436with the htmllib module). Fixed the documentation of htmllib
2437(finally).
2438
2439- The reference manual is now maintained in FrameMaker.
2440
2441- Upgraded scripts Doc/partparse.py and Doc/texi2html.py.
2442
2443- Slight improvements to Doc/Makefile.
2444
2445- Added fcntl.lockf(). This should be used for Unix file locking
2446instead of the posixfile module; lockf() is more portable.
2447
2448- The getopt module now supports long option names, thanks to Lars
2449Wizenius.
2450
2451- Plenty of changes to Tkinter and Canvas, mostly due to Fred Drake
2452and Nils Fischbeck.
2453
2454- Use more bits of time.time() in whrandom's default seed().
2455
2456- Performance hack for regex module's regs attribute.
2457
2458- Don't close already closed socket in socket module.
2459
2460- Correctly handle separators containing embedded nulls in
2461strop.split, strop.find and strop.rfind. Also added more detail to
2462error message for strop.atoi and friends.
2463
2464- Moved fallback definition for hypot() to Python/hypot.c.
2465
2466- Added fallback definition for strdup, in Python/strdup.c.
2467
2468- Fixed some bugs where a function would return 0 to indicate an error
2469where it should return -1.
2470
2471- Test for error returned by time.localtime(), and rationalized its MS
2472tests.
2473
2474- Added Modules/Setup.local file, which is processed after Setup.
2475
2476- Corrected bug in toplevel Makefile.in -- execution of regen script
2477would not use the right PATH and PYTHONPATH.
2478
2479- Various and sundry NeXT configuration changes (sigh).
2480
2481- Support systems where libreadline needs neither termcap nor curses.
2482
2483- Improved ld_so_aix script and python.exp file (for AIX).
2484
2485- More stringent test for working <stdarg.h> in configure script.
2486
2487- Removed Demo/www subdirectory -- it was totally out of date.
2488
2489- Improved demos and docs for Fred Drake's parser module; fixed one
2490typo in the module itself.
2491
2492
2493=========================================
2494==> Release 1.4beta3 (August 26 1996) <==
2495=========================================
2496
2497
2498(XXX This is less readable that it should. I promise to restructure
2499it for the final 1.4 release.)
2500
2501
2502What's new in 1.4beta3 (since beta2)?
2503-------------------------------------
2504
2505- Name mangling to implement a simple form of class-private variables.
2506A name of the form "__spam" can't easily be used outside the class.
2507(This was added in 1.4beta3, but left out of the 1.4beta3 release
2508message.)
2509
2510- In urllib.urlopen(): HTTP URLs containing user:passwd@host are now
2511handled correctly when using a proxy server.
2512
2513- In ntpath.normpath(): don't truncate to 8+3 format.
2514
2515- In mimetools.choose_boundary(): don't die when getuid() or getpid()
2516aren't defined.
2517
2518- Module urllib: some optimizations to (un)quoting.
2519
2520- New module MimeWriter for writing MIME documents.
2521
2522- More changes to formatter module.
2523
2524- The freeze script works once again and is much more robust (using
2525sys.prefix etc.). It also supports a -o option to specify an
2526output directory.
2527
2528- New module whichdb recognizes dbm, gdbm and bsddb/dbhash files.
2529
2530- The Doc/Makefile targets have been reorganized somewhat to remove the
2531insistence on always generating PostScript.
2532
2533- The texinfo to html filter (Doc/texi2html.py) has been improved somewhat.
2534
2535- "errors.h" has been renamed to "pyerrors.h" to resolve a long-standing
2536name conflict on the Mac.
2537
2538- Linking a module compiled with a different setting for Py_TRACE_REFS now
2539generates a linker error rather than a core dump.
2540
2541- The cgi module has a new convenience function print_exception(), which
2542formats a python exception using HTML. It also fixes a bug in the
2543compatibility code and adds a dubious feature which makes it possible to
2544have two query strings, one in the URL and one in the POST data.
2545
2546- A subtle change in the unpickling of class instances makes it possible
2547to unpickle in restricted execution mode, where the __dict__ attribute is
2548not available (but setattr() is).
2549
2550- Documentation for os.path.splitext() (== posixpath.splitext()) has been
2551cleared up. It splits at the *last* dot.
2552
2553- posixfile locking is now also correctly supported on AIX.
2554
2555- The tempfile module once again honors an initial setting of tmpdir. It
2556now works on Windows, too.
2557
2558- The traceback module has some new functions to extract, format and print
2559the active stack.
2560
2561- Some translation functions in the urllib module have been made a little
2562less sluggish.
2563
2564- The addtag_* methods for Canvas widgets in Tkinter as well as in the
2565separate Canvas class have been fixed so they actually do something
2566meaningful.
2567
2568- A tiny _test() function has been added to Tkinter.py.
2569
2570- A generic Makefile for dynamically loaded modules is provided in the Misc
2571subdirectory (Misc/gMakefile).
2572
2573- A new version of python-mode.el for Emacs is provided. See
2574http://www.python.org/ftp/emacs/pmdetails.html for details. The
2575separate file pyimenu.el is no longer needed, imenu support is folded
2576into python-mode.el.
2577
2578- The configure script can finally correctly find the readline library in a
2579non-standard location. The LDFLAGS variable is passed on the the Makefiles
2580from the configure script.
2581
2582- Shared libraries are now installed as programs (i.e. with executable
2583permission). This is required on HP-UX and won't hurt on other systems.
2584
2585- The objc.c module is no longer part of the distribution. Objective-C
2586support may become available as contributed software on the ftp site.
2587
2588- The sybase module is no longer part of the distribution. A much
2589improved sybase module is available as contributed software from the
2590ftp site.
2591
2592- _tkinter is now compatible with Tcl 7.5 / Tk 4.1 patch1 on Windows and
2593Mac (don't use unpatched Tcl/Tk!). The default line in the Setup.in file
2594now links with Tcl 7.5 / Tk 4.1 rather than 7.4/4.0.
2595
2596- In Setup, you can now write "*shared*" instead of "*noconfig*", and you
2597can use *.so and *.sl as shared libraries.
2598
2599- Some more fidgeting for AIX shared libraries.
2600
2601- The mpz module is now compatible with GMP 2.x. (Not tested by me.)
2602(Note -- a complete replacement by Niels Mo"ller, called gpmodule, is
2603available from the contrib directory on the ftp site.)
2604
2605- A warning is written to sys.stderr when a __del__ method raises an
2606exception (formerly, such exceptions were completely ignored).
2607
2608- The configure script now defines HAVE_OLD_CPP if the C preprocessor is
2609incapable of ANSI style token concatenation and stringification.
2610
2611- All source files (except a few platform specific modules) are once again
2612compatible with K&R C compilers as well as ANSI compilers. In particular,
2613ANSI-isms have been removed or made conditional in complexobject.c,
2614getargs.c and operator.c.
2615
2616- The abstract object API has three new functions, PyObject_DelItem,
2617PySequence_DelItem, and PySequence_DelSlice.
2618
2619- The operator module has new functions delitem and delslice, and the
2620functions "or" and "and" are renamed to "or_" and "and_" (since "or" and
2621"and" are reserved words). ("__or__" and "__and__" are unchanged.)
2622
2623- The environment module is no longer supported; putenv() is now a function
2624in posixmodule (also under NT).
2625
2626- Error in filter(<function>, "") has been fixed.
2627
2628- Unrecognized keyword arguments raise TypeError, not KeyError.
2629
2630- Better portability, fewer bugs and memory leaks, fewer compiler warnings,
2631some more documentation.
2632
2633- Bug in float power boundary case (0.0 to the negative integer power)
2634fixed.
2635
2636- The test of negative number to the float power has been moved from the
2637built-in pow() functin to floatobject.c (so complex numbers can yield the
2638correct result).
2639
2640- The bug introduced in beta2 where shared libraries loaded (using
2641dlopen()) from the current directory would fail, has been fixed.
2642
2643- Modules imported as shared libraries now also have a __file__ attribute,
2644giving the filename from which they were loaded. The only modules without
2645a __file__ attribute now are built-in modules.
2646
2647- On the Mac, dynamically loaded modules can end in either ".slb" or
2648".<platform>.slb" where <platform> is either "CFM68K" or "ppc". The ".slb"
2649extension should only be used for "fat" binaries.
2650
2651- C API addition: marshal.c now supports
2652PyMarshal_WriteObjectToString(object).
2653
2654- C API addition: getargs.c now supports
2655PyArg_ParseTupleAndKeywords(args, kwdict, format, kwnames, ...)
2656to parse keyword arguments.
2657
2658- The PC versioning scheme (sys.winver) has changed once again. the
2659version number is now "<digit>.<digit>.<digit>.<apiversion>", where the
2660first three <digit>s are the Python version (e.g. "1.4.0" for Python 1.4,
2661"1.4.1" for Python 1.4.1 -- the beta level is not included) and
2662<apiversion> is the four-digit PYTHON_API_VERSION (currently 1005).
2663
2664- h2py.py accepts whitespace before the # in CPP directives
2665
2666- On Solaris 2.5, it should now be possible to use either Posix threads or
2667Solaris threads (XXX: how do you select which is used???). (Note: the
2668Python pthreads interface doesn't fully support semaphores yet -- anyone
2669care to fix this?)
2670
2671- Thread support should now work on AIX, using either DCE threads or
2672pthreads.
2673
2674- New file Demo/sockets/unicast.py
2675
2676- Working Mac port, with CFM68K support, with Tk 4.1 support (though not
2677both) (XXX)
2678
2679- New project setup for PC port, now compatible with PythonWin, with
2680_tkinter and NumPy support (XXX)
2681
2682- New module site.py (XXX)
2683
2684- New module xdrlib.py and optional support module _xdrmodule.c (XXX)
2685
2686- parser module adapted to new grammar, complete w/ Doc & Demo (XXX)
2687
2688- regen script fixed (XXX)
2689
2690- new machdep subdirectories Lib/{aix3,aix4,next3_3,freebsd2,linux2} (XXX)
2691
2692- testall now also tests math module (XXX)
2693
2694- string.atoi c.s. now raise an exception for an empty input string.
2695
2696- At last, it is no longer necessary to define HAVE_CONFIG_H in order to
2697have config.h included at various places.
2698
2699- Unrecognized keyword arguments now raise TypeError rather than KeyError.
2700
2701- The makesetup script recognizes files with extension .so or .sl as
2702(shared) libraries.
2703
2704- 'access' is no longer a reserved word, and all code related to its
2705implementation is gone (or at least #ifdef'ed out). This should make
2706Python a little speedier too!
2707
2708- Performance enhancements suggested by Sjoerd Mullender. This includes
2709the introduction of two new optional function pointers in type object,
2710getattro and setattro, which are like getattr and setattr but take a
2711string object instead of a C string pointer.
2712
2713- New operations in string module: lstrip(s) and rstrip(s) strip whitespace
2714only on the left or only on the right, A new optional third argument to
2715split() specifies the maximum number of separators honored (so
2716splitfields(s, sep, n) returns a list of at most n+1 elements). (Since
27171.3, splitfields(s, None) is totally equivalent to split(s).)
2718string.capwords() has an optional second argument specifying the
2719separator (which is passed to split()).
2720
2721- regsub.split() has the same addition as string.split(). regsub.splitx(s,
2722sep, maxsep) implements the functionality that was regsub.split(s, 1) in
27231.4beta2 (return a list containing the delimiters as well as the words).
2724
2725- Final touch for AIX loading, rewritten Misc/AIX-NOTES.
2726
2727- In Modules/_tkinter.c, when using Tk 4.1 or higher, use className
2728argument to _tkinter.create() to set Tcl's argv0 variable, so X
2729resources use the right resource class again.
2730
2731- Add #undef fabs to Modules/mathmodule.c for macintosh.
2732
2733- Added some macro renames for AIX in Modules/operator.c.
2734
2735- Removed spurious 'E' from Doc/liberrno.tex.
2736
2737- Got rid of some cruft in Misc/ (dlMakefile, pyimenu.el); added new
2738Misc/gMakefile and new version of Misc/python-mode.el.
2739
2740- Fixed typo in Lib/ntpath.py (islink has "return false" which gives a
2741NameError).
2742
2743- Added missing "from types import *" to Lib/tkinter/Canvas.py.
2744
2745- Added hint about using default args for __init__ to pickle docs.
2746
2747- Corrected typo in Inclide/abstract.h: PySequence_Lenth ->
2748PySequence_Length.
2749
2750- Some improvements to Doc/texi2html.py.
2751
2752- In Python/import.c, Cast unsigned char * in struct _frozen to char *
2753in calls to rds_object().
2754
2755- In doc/ref4.tex, added note about scope of lambda bodies.
2756
2757What's new in 1.4beta2 (since beta1)?
2758-------------------------------------
2759
2760- Portability bug in the md5.h header solved.
2761
2762- The PC build procedure now really works, and sets sys.platform to a
2763meaningful value (a few things were botched in beta 1). Lib/dos_8x3
2764is now a standard part of the distribution (alas).
2765
2766- More improvements to the installation procedure. Typing "make install"
2767now inserts the version number in the pathnames of almost everything
2768installed, and creates the machine dependent modules (FCNTL.py etc.) if not
2769supplied by the distribution. (XXX There's still a problem with the latter
2770because the "regen" script requires that Python is installed. Some manual
2771intervention may still be required.) (This has been fixed in 1.4beta3.)
2772
2773- New modules: errno, operator (XXX).
2774
2775- Changes for use with Numerical Python: builtin function slice() and
2776Ellipses object, and corresponding syntax:
2777
2778 x[lo:hi:stride] == x[slice(lo, hi, stride)]
2779 x[a, ..., z] == x[(a, Ellipses, z)]
2780
2781- New documentation for errno and cgi mdoules.
2782
2783- The directory containing the script passed to the interpreter is
2784inserted in from of sys.path; "." is no longer a default path
2785component.
2786
2787- Optional third string argument to string.translate() specifies
2788characters to delete. New function string.maketrans() creates a
2789translation table for translate() or for regex.compile().
2790
2791- Module posix (and hence module os under Unix) now supports putenv().
2792Moreover, module os is enhanced so that if putenv() is supported,
2793assignments to os.environ entries make the appropriate putenv() call.
2794(XXX the putenv() implementation can leak a small amount of memory per
2795call.)
2796
2797- pdb.py can now be invoked from the command line to debug a script:
2798python pdb.py <script> <arg> ...
2799
2800- Much improved parseaddr() in rfc822.
2801
2802- In cgi.py, you can now pass an alternative value for environ to
2803nearly all functions.
2804
2805- You can now assign to instance variables whose name begins and ends
2806with '__'.
2807
2808- New version of Fred Drake's parser module and associates (token,
2809symbol, AST).
2810
2811- New PYTHON_API_VERSION value and .pyc file magic number (again!).
2812
2813- The "complex" internal structure type is now called "Py_complex" to
2814avoid name conflicts.
2815
2816- Numerous small bugs fixed.
2817
2818- Slight pickle speedups.
2819
2820- Some slight speedups suggested by Sjoerd (more coming in 1.4 final).
2821
2822- NeXT portability mods by Bill Bumgarner integrated.
2823
2824- Modules regexmodule.c, bsddbmodule.c and xxmodule.c have been
2825converted to new naming style.
2826
2827
2828What's new in 1.4beta1 (since 1.3)?
2829-----------------------------------
2830
2831- Added sys.platform and sys.exec_platform for Bill Janssen.
2832
2833- Installation has been completely overhauled. "make install" now installs
2834everything, not just the python binary. Installation uses the install-sh
2835script (borrowed from X11) to install each file.
2836
2837- New functions in the posix module: mkfifo, plock, remove (== unlink),
2838and ftruncate. More functions are also available under NT.
2839
2840- New function in the fcntl module: flock.
2841
2842- Shared library support for FreeBSD.
2843
2844- The --with-readline option can now be used without a DIRECTORY argument,
2845for systems where libreadline.* is in one of the standard places. It is
2846also possible for it to be a shared library.
2847
2848- The extension tkinter has been renamed to _tkinter, to avoid confusion
2849with Tkinter.py oncase insensitive file systems. It now supports Tk 4.1 as
2850well as 4.0.
2851
2852- Author's change of address from CWI in Amsterdam, The Netherlands, to
2853CNRI in Reston, VA, USA.
2854
2855- The math.hypot() function is now always available (if it isn't found in
2856the C math library, Python provides its own implementation).
2857
2858- The latex documentation is now compatible with latex2e, thanks to David
2859Ascher.
2860
2861- The expression x**y is now equivalent to pow(x, y).
2862
2863- The indexing expression x[a, b, c] is now equivalent to x[(a, b, c)].
2864
2865- Complex numbers are now supported. Imaginary constants are written with
2866a 'j' or 'J' prefix, general complex numbers can be formed by adding a real
2867part to an imaginary part, like 3+4j. Complex numbers are always stored in
2868floating point form, so this is equivalent to 3.0+4.0j. It is also
2869possible to create complex numbers with the new built-in function
2870complex(re, [im]). For the footprint-conscious, complex number support can
2871be disabled by defining the symbol WITHOUT_COMPLEX.
2872
2873- New built-in function list() is the long-awaited counterpart of tuple().
2874
2875- There's a new "cmath" module which provides the same functions as the
2876"math" library but with complex arguments and results. (There are very
2877good reasons why math.sqrt(-1) still raises an exception -- you have to use
2878cmath.sqrt(-1) to get 1j for an answer.)
2879
2880- The Python.h header file (which is really the same as allobjects.h except
2881it disables support for old style names) now includes several more files,
2882so you have to have fewer #include statements in the average extension.
2883
2884- The NDEBUG symbol is no longer used. Code that used to be dependent on
2885the presence of NDEBUG is now present on the absence of DEBUG. TRACE_REFS
2886and REF_DEBUG have been renamed to Py_TRACE_REFS and Py_REF_DEBUG,
2887respectively. At long last, the source actually compiles and links without
2888errors when this symbol is defined.
2889
2890- Several symbols that didn't follow the new naming scheme have been
2891renamed (usually by adding to rename2.h) to use a Py or _Py prefix. There
2892are no external symbols left without a Py or _Py prefix, not even those
2893defined by sources that were incorporated from elsewhere (regexpr.c,
2894md5c.c). (Macros are a different story...)
2895
2896- There are now typedefs for the structures defined in config.c and
2897frozen.c.
2898
2899- New PYTHON_API_VERSION value and .pyc file magic number.
2900
2901- New module Bastion. (XXX)
2902
2903- Improved performance of StringIO module.
2904
2905- UserList module now supports + and * operators.
2906
2907- The binhex and binascii modules now actually work.
2908
2909- The cgi module has been almost totally rewritten and documented.
2910It now supports file upload and a new data type to handle forms more
2911flexibly.
2912
2913- The formatter module (for use with htmllib) has been overhauled (again).
2914
2915- The ftplib module now supports passive mode and has doc strings.
2916
2917- In (ideally) all places where binary files are read or written, the file
2918is now correctly opened in binary mode ('rb' or 'wb') so the code will work
2919on Mac or PC.
2920
2921- Dummy versions of os.path.expandvars() and expanduser() are now provided
2922on non-Unix platforms.
2923
2924- Module urllib now has two new functions url2pathname and pathname2url
2925which turn local filenames into "file:..." URLs using the same rules as
2926Netscape (why be different). it also supports urlretrieve() with a
2927pathname parameter, and honors the proxy environment variables (http_proxy
2928etc.). The URL parsing has been improved somewhat, too.
2929
2930- Micro improvements to urlparse. Added urlparse.urldefrag() which
2931removes a trailing ``#fragment'' if any.
2932
2933- The mailbox module now supports MH style message delimiters as well.
2934
2935- The mhlib module contains some new functionality: setcontext() to set the
2936current folder and parsesequence() to parse a sequence as commonly passed
2937to MH commands (e.g. 1-10 or last:5).
2938
2939- New module mimify for conversion to and from MIME format of email
2940messages.
2941
2942- Module ni now automatically installs itself when first imported -- this
2943is against the normal rule that modules should define classes and functions
2944but not invoke them, but appears more useful in the case that two
2945different, independent modules want to use ni's features.
2946
2947- Some small performance enhancements in module pickle.
2948
2949- Small interface change to the profile.run*() family of functions -- more
2950sensible handling of return values.
2951
2952- The officially registered Mac creator for Python files is 'Pyth'. This
2953replaces 'PYTH' which was used before but never registered.
2954
2955- Added regsub.capwords(). (XXX)
2956
2957- Added string.capwords(), string.capitalize() and string.translate().
2958(XXX)
2959
2960- Fixed an interface bug in the rexec module: it was impossible to pass a
2961hooks instance to the RExec class. rexec now also supports the dynamic
2962loading of modules from shared libraries. Some other interfaces have been
2963added too.
2964
2965- Module rfc822 now caches the headers in a dictionary for more efficient
2966lookup.
2967
2968- The sgmllib module now understands a limited number of SGML "shorthands"
2969like <A/.../ for <A>...</A>. (It's not clear that this was a good idea...)
2970
2971- The tempfile module actually tries a number of different places to find a
2972usable temporary directory. (This was prompted by certain Linux
2973installations that appear to be missing a /usr/tmp directory.) [A bug in
2974the implementation that would ignore a pre-existing tmpdir global has been
2975fixed in beta3.]
2976
2977- Much improved and enhanved FileDialog module for Tkinter.
2978
2979- Many small changes to Tkinter, to bring it more in line with Tk 4.0 (as
2980well as Tk 4.1).
2981
2982- New socket interfaces include ntohs(), ntohl(), htons(), htonl(), and
2983s.dup(). Sockets now work correctly on Windows. On Windows, the built-in
2984extension is called _socket and a wrapper module win/socket.py provides
2985"makefile()" and "dup()" functionality. On Windows, the select module
2986works only with socket objects.
2987
2988- Bugs in bsddb module fixed (e.g. missing default argument values).
2989
2990- The curses extension now includes <ncurses.h> when available.
2991
2992- The gdbm module now supports opening databases in "fast" mode by
2993specifying 'f' as the second character or the mode string.
2994
2995- new variables sys.prefix and sys.exec_prefix pass corresponding
2996configuration options / Makefile variables to the Python programmer.
2997
2998- The ``new'' module now supports creating new user-defined classes as well
2999as instances thereof.
3000
3001- The soundex module now sports get_soundex() to get the soundex value for an
3002arbitrary string (formerly it would only do soundex-based string
3003comparison) as well as doc strings.
3004
3005- New object type "cobject" to safely wrap void pointers for passing them
3006between various extension modules.
3007
3008- More efficient computation of float**smallint.
3009
3010- The mysterious bug whereby "x.x" (two occurrences of the same
3011one-character name) typed from the commandline would sometimes fail
3012mysteriously.
3013
3014- The initialization of the readline function can now be invoked by a C
3015extension through PyOS_ReadlineInit().
3016
3017- There's now an externally visible pointer PyImport_FrozenModules which
3018can be changed by an embedding application.
3019
3020- The argument parsing functions now support a new format character 'D' to
3021specify complex numbers.
3022
3023- Various memory leaks plugged and bugs fixed.
3024
3025- Improved support for posix threads (now that real implementations are
3026beginning to apepar). Still no fully functioning semaphores.
3027
3028- Some various and sundry improvements and new entries in the Tools
3029directory.
3030
3031
3032=====================================
Guido van Rossumc30e95f1996-07-30 18:53:51 +00003033==> Release 1.3 (13 October 1995) <==
3034=====================================
3035
3036Major change
3037============
3038
3039Two words: Keyword Arguments. See the first section of Chapter 12 of
3040the Tutorial.
3041
3042(The rest of this file is textually the same as the remaining sections
3043of that chapter.)
3044
3045
3046Changes to the WWW and Internet tools
3047=====================================
3048
3049The "htmllib" module has been rewritten in an incompatible fashion.
3050The new version is considerably more complete (HTML 2.0 except forms,
3051but including all ISO-8859-1 entity definitions), and easy to use.
3052Small changes to "sgmllib" have also been made, to better match the
3053tokenization of HTML as recognized by other web tools.
3054
3055A new module "formatter" has been added, for use with the new
3056"htmllib" module.
3057
3058The "urllib"and "httplib" modules have been changed somewhat to allow
3059overriding unknown URL types and to support authentication. They now
3060use "mimetools.Message" instead of "rfc822.Message" to parse headers.
3061The "endrequest()" method has been removed from the HTTP class since
3062it breaks the interaction with some servers.
3063
3064The "rfc822.Message" class has been changed to allow a flag to be
3065passed in that says that the file is unseekable.
3066
3067The "ftplib" module has been fixed to be (hopefully) more robust on
3068Linux.
3069
3070Several new operations that are optionally supported by servers have
3071been added to "nntplib": "xover", "xgtitle", "xpath" and "date".
3072
3073Other Language Changes
3074======================
3075
3076The "raise" statement now takes an optional argument which specifies
3077the traceback to be used when printing the exception's stack trace.
3078This must be a traceback object, such as found in "sys.exc_traceback".
3079When omitted or given as "None", the old behavior (to generate a stack
3080trace entry for the current stack frame) is used.
3081
3082The tokenizer is now more tolerant of alien whitespace. Control-L in
3083the leading whitespace of a line resets the column number to zero,
3084while Control-R just before the end of the line is ignored.
3085
3086Changes to Built-in Operations
3087==============================
3088
3089For file objects, "f.read(0)" and "f.readline(0)" now return an empty
3090string rather than reading an unlimited number of bytes. For the
3091latter, omit the argument altogether or pass a negative value.
3092
3093A new system variable, "sys.platform", has been added. It specifies
3094the current platform, e.g. "sunos5" or "linux1".
3095
3096The built-in functions "input()" and "raw_input()" now use the GNU
3097readline library when it has been configured (formerly, only
3098interactive input to the interpreter itself was read using GNU
3099readline). The GNU readline library provides elaborate line editing
3100and history. The Python debugger ("pdb") is the first beneficiary of
3101this change.
3102
3103Two new built-in functions, "globals()" and "locals()", provide access
3104to dictionaries containming current global and local variables,
3105respectively. (These augment rather than replace "vars()", which
3106returns the current local variables when called without an argument,
3107and a module's global variables when called with an argument of type
3108module.)
3109
3110The built-in function "compile()" now takes a third possible value for
3111the kind of code to be compiled: specifying "'single'" generates code
3112for a single interactive statement, which prints the output of
3113expression statements that evaluate to something else than "None".
3114
3115Library Changes
3116===============
3117
3118There are new module "ni" and "ihooks" that support importing modules
3119with hierarchical names such as "A.B.C". This is enabled by writing
3120"import ni; ni.ni()" at the very top of the main program. These
3121modules are amply documented in the Python source.
3122
3123The module "rexec" has been rewritten (incompatibly) to define a class
3124and to use "ihooks".
3125
3126The "string.split()" and "string.splitfields()" functions are now the
3127same function (the presence or absence of the second argument
3128determines which operation is invoked); similar for "string.join()"
3129and "string.joinfields()".
3130
3131The "Tkinter" module and its helper "Dialog" have been revamped to use
3132keyword arguments. Tk 4.0 is now the standard. A new module
3133"FileDialog" has been added which implements standard file selection
3134dialogs.
3135
3136The optional built-in modules "dbm" and "gdbm" are more coordinated
3137--- their "open()" functions now take the same values for their "flag"
3138argument, and the "flag" and "mode" argument have default values (to
3139open the database for reading only, and to create the database with
3140mode "0666" minuse the umask, respectively). The memory leaks have
3141finally been fixed.
3142
3143A new dbm-like module, "bsddb", has been added, which uses the BSD DB
3144package's hash method.
3145
3146A portable (though slow) dbm-clone, implemented in Python, has been
3147added for systems where none of the above is provided. It is aptly
3148dubbed "dumbdbm".
3149
3150The module "anydbm" provides a unified interface to "bsddb", "gdbm",
3151"dbm", and "dumbdbm", choosing the first one available.
3152
3153A new extension module, "binascii", provides a variety of operations
3154for conversion of text-encoded binary data.
3155
3156There are three new or rewritten companion modules implemented in
3157Python that can encode and decode the most common such formats: "uu"
3158(uuencode), "base64" and "binhex".
3159
3160A module to handle the MIME encoding quoted-printable has also been
3161added: "quopri".
3162
3163The parser module (which provides an interface to the Python parser's
3164abstract syntax trees) has been rewritten (incompatibly) by Fred
3165Drake. It now lets you change the parse tree and compile the result!
3166
3167The \code{syslog} module has been upgraded and documented.
3168
3169Other Changes
3170=============
3171
3172The dynamic module loader recognizes the fact that different filenames
3173point to the same shared library and loads the library only once, so
3174you can have a single shared library that defines multiple modules.
3175(SunOS / SVR4 style shared libraries only.)
3176
3177Jim Fulton's ``abstract object interface'' has been incorporated into
3178the run-time API. For more detailes, read the files
3179"Include/abstract.h" and "Objects/abstract.c".
3180
3181The Macintosh version is much more robust now.
3182
3183Numerous things I have forgotten or that are so obscure no-one will
3184notice them anyway :-)
3185
3186
Guido van Rossumf456b6d1995-01-04 19:20:37 +00003187===================================
Guido van Rossumd462f3d1995-10-09 21:30:37 +00003188==> Release 1.2 (13 April 1995) <==
3189===================================
3190
3191- Changes to Misc/python-mode.el:
3192 - Wrapping and indentation within triple quote strings should work
3193 properly now.
3194 - `Standard' bug reporting mechanism (use C-c C-b)
3195 - py-mark-block was moved to C-c C-m
3196 - C-c C-v shows you the python-mode version
3197 - a basic python-font-lock-keywords has been added for Emacs 19
3198 font-lock colorizations.
3199 - proper interaction with pending-del and del-sel modes.
3200 - New py-electric-colon (:) command for improved outdenting. Also
3201 py-indent-line (TAB) should handle outdented lines better.
3202 - New commands py-outdent-left (C-c C-l) and py-indent-right (C-c C-r)
3203
3204- The Library Reference has been restructured, and many new and
3205existing modules are now documented, in particular the debugger and
3206the profiler, as well as the persistency and the WWW/Internet support
3207modules.
3208
3209- All known bugs have been fixed. For example the pow(2,2,3L) bug on
3210Linux has been fixed. Also the re-entrancy problems with __del__ have
3211been fixed.
3212
3213- All known memory leaks have been fixed.
3214
3215- Phase 2 of the Great Renaming has been executed. The header files
3216now use the new names (PyObject instead of object, etc.). The linker
3217also sees the new names. Most source files still use the old names,
3218by virtue of the rename2.h header file. If you include Python.h, you
3219only see the new names. Dynamically linked modules have to be
3220recompiled. (Phase 3, fixing the rest of the sources, will be
3221executed gradually with the release later versions.)
3222
3223- The hooks for implementing "safe-python" (better called "restricted
3224execution") are in place. Specifically, the import statement is
3225implemented by calling the built-in function __import__, and the
3226built-in names used in a particular scope are taken from the
3227dictionary __builtins__ in that scope's global dictionary. See also
3228the new (unsupported, undocumented) module rexec.py.
3229
3230- The import statement now supports the syntax "import a.b.c" and
3231"from a.b.c import name". No officially supported implementation
3232exists, but one can be prototyped by replacing the built-in __import__
3233function. A proposal by Ken Manheimer is provided as newimp.py.
3234
3235- All machinery used by the import statement (or the built-in
3236__import__ function) is now exposed through the new built-in module
3237"imp" (see the library reference manual). All dynamic loading
3238machinery is moved to the new file importdl.c.
3239
3240- Persistent storage is supported through the use of the modules
3241"pickle" and "shelve" (implemented in Python). There's also a "copy"
3242module implementing deepcopy and normal (shallow) copy operations.
3243See the library reference manual.
3244
3245- Documentation strings for many objects types are accessible through
3246the __doc__ attribute. Modules, classes and functions support special
3247syntax to initialize the __doc__ attribute: if the first statement
3248consists of just a string literal, that string literal becomes the
3249value of the __doc__ attribute. The default __doc__ attribute is
3250None. Documentation strings are also supported for built-in
3251functions, types and modules; however this feature hasn't been widely
3252used yet. See the 'new' module for an example. (Basically, the type
3253object's tp_doc field contains the doc string for the type, and the
32544th member of the methodlist structure contains the doc string for the
3255method.)
3256
3257- The __coerce__ and __cmp__ methods for user-defined classes once
3258again work as expected. As an example, there's a new standard class
3259Complex in the library.
3260
3261- The functions posix.popen() and posix.fdopen() now have an optional
3262third argument to specify the buffer size, and default their second
3263(mode) argument to 'r' -- in analogy to the builtin open() function.
3264The same applies to posixfile.open() and the socket method makefile().
3265
3266- The thread.exit_thread() function now raises SystemExit so that
3267'finally' clauses are honored and a memory leak is plugged.
3268
3269- Improved X11 and Motif support, by Sjoerd Mullender. This extension
3270is being maintained and distributed separately.
3271
3272- Improved support for the Apple Macintosh, in part by Jack Jansen,
3273e.g. interfaces to (a few) resource mananger functions, get/set file
3274type and creator, gestalt, sound manager, speech manager, MacTCP, comm
3275toolbox, and the think C console library. This is being maintained
3276and distributed separately.
3277
3278- Improved version for Windows NT, by Mark Hammond. This is being
3279maintained and distributed separately.
3280
3281- Used autoconf 2.0 to generate the configure script. Adapted
3282configure.in to use the new features in autoconf 2.0.
3283
3284- It now builds on the NeXT without intervention, even on the 3.3
3285Sparc pre-release.
3286
3287- Characters passed to isspace() and friends are masked to nonnegative
3288values.
3289
3290- Correctly compute pow(-3.0, 3).
3291
3292- Fix portability problems with getopt (configure now checks for a
3293non-GNU getopt).
3294
3295- Don't add frozenmain.o to libPython.a.
3296
3297- Exceptions can now be classes. ALl built-in exceptions are still
3298string objects, but this will change in the future.
3299
3300- The socket module exports a long list of socket related symbols.
3301(More built-in modules will export their symbolic constants instead of
3302relying on a separately generated Python module.)
3303
3304- When a module object is deleted, it clears out its own dictionary.
3305This fixes a circularity in the references between functions and
3306their global dictionary.
3307
3308- Changed the error handling by [new]getargs() e.g. for "O&".
3309
3310- Dynamic loading of modules using shared libraries is supported for
3311several new platforms.
3312
3313- Support "O&", "[...]" and "{...}" in mkvalue().
3314
3315- Extension to findmethod(): findmethodinchain() (where a chain is a
3316linked list of methodlist arrays). The calling interface for
3317findmethod() has changed: it now gets a pointer to the (static!)
3318methodlist structure rather than just to the function name -- this
3319saves copying flags etc. into the (short-lived) method object.
3320
3321- The callable() function is now public.
3322
3323- Object types can define a few new operations by setting function
3324pointers in the type object structure: tp_call defines how an object
3325is called, and tp_str defines how an object's str() is computed.
3326
3327
3328===================================
Guido van Rossumf456b6d1995-01-04 19:20:37 +00003329==> Release 1.1.1 (10 Nov 1994) <==
3330===================================
3331
3332This is a pure bugfix release again. See the ChangeLog file for details.
3333
3334One exception: a few new features were added to tkinter.
3335
3336
3337=================================
3338==> Release 1.1 (11 Oct 1994) <==
3339=================================
3340
3341This release adds several new features, improved configuration and
3342portability, and fixes more bugs than I can list here (including some
3343memory leaks).
3344
3345The source compiles and runs out of the box on more platforms than
3346ever -- including Windows NT. Makefiles or projects for a variety of
3347non-UNIX platforms are provided.
3348
3349APOLOGY: some new features are badly documented or not at all. I had
3350the choice -- postpone the new release indefinitely, or release it
3351now, with working code but some undocumented areas. The problem with
3352postponing the release is that people continue to suffer from existing
3353bugs, and send me patches based on the previous release -- which I
3354can't apply directly because my own source has changed. Also, some
3355new modules (like signal) have been ready for release for quite some
3356time, and people are anxiously waiting for them. In the case of
3357signal, the interface is simple enough to figure out without
3358documentation (if you're anxious enough :-). In this case it was not
3359simple to release the module on its own, since it relies on many small
3360patches elsewhere in the source.
3361
3362For most new Python modules, the source code contains comments that
3363explain how to use them. Documentation for the Tk interface, written
3364by Matt Conway, is available as tkinter-doc.tar.gz from the Python
3365home and mirror ftp sites (see Misc/FAQ for ftp addresses). For the
3366new operator overloading facilities, have a look at Demo/classes:
3367Complex.py and Rat.py show how to implement a numeric type without and
3368with __coerce__ method. Also have a look at the end of the Tutorial
3369document (Doc/tut.tex). If you're still confused: use the newsgroup
3370or mailing list.
3371
3372
3373New language features:
3374
3375 - More flexible operator overloading for user-defined classes
3376 (INCOMPATIBLE WITH PREVIOUS VERSIONS!) See end of tutorial.
3377
3378 - Classes can define methods named __getattr__, __setattr__ and
3379 __delattr__ to trap attribute accesses. See end of tutorial.
3380
3381 - Classes can define method __call__ so instances can be called
3382 directly. See end of tutorial.
3383
3384
3385New support facilities:
3386
3387 - The Makefiles (for the base interpreter as well as for extensions)
3388 now support creating dynamically loadable modules if the platform
3389 supports shared libraries.
3390
3391 - Passing the interpreter a .pyc file as script argument will execute
3392 the code in that file. (On the Mac such files can be double-clicked!)
3393
3394 - New Freeze script, to create independently distributable "binaries"
3395 of Python programs -- look in Demo/freeze
3396
3397 - Improved h2py script (in Demo/scripts) follows #includes and
3398 supports macros with one argument
3399
3400 - New module compileall generates .pyc files for all modules in a
3401 directory (tree) without also executing them
3402
3403 - Threads should work on more platforms
3404
3405
3406New built-in modules:
3407
3408 - tkinter (support for Tcl's Tk widget set) is now part of the base
3409 distribution
3410
3411 - signal allows catching or ignoring UNIX signals (unfortunately still
3412 undocumented -- any taker?)
3413
3414 - termios provides portable access to POSIX tty settings
3415
3416 - curses provides an interface to the System V curses library
3417
3418 - syslog provides an interface to the (BSD?) syslog daemon
3419
3420 - 'new' provides interfaces to create new built-in object types
3421 (e.g. modules and functions)
3422
3423 - sybase provides an interface to SYBASE database
3424
3425
3426New/obsolete built-in methods:
3427
3428 - callable(x) tests whether x can be called
3429
3430 - sockets now have a setblocking() method
3431
3432 - sockets no longer have an allowbroadcast() method
3433
3434 - socket methods send() and sendto() return byte count
3435
3436
3437New standard library modules:
3438
3439 - types.py defines standard names for built-in types, e.g. StringType
3440
3441 - urlparse.py parses URLs according to the latest Internet draft
3442
3443 - uu.py does uuencode/uudecode (not the fastest in the world, but
3444 quicker than installing uuencode on a non-UNIX machine :-)
3445
3446 - New, faster and more powerful profile module.py
3447
3448 - mhlib.py provides interface to MH folders and messages
3449
3450
3451New facilities for extension writers (unfortunately still
3452undocumented):
3453
3454 - newgetargs() supports optional arguments and improved error messages
3455
3456 - O!, O& O? formats for getargs allow more versatile type checking of
3457 non-standard types
3458
3459 - can register pending asynchronous callback, to be called the next
3460 time the Python VM begins a new instruction (Py_AddPendingCall)
3461
3462 - can register cleanup routines to be called when Python exits
3463 (Py_AtExit)
3464
3465 - makesetup script understands C++ files in Setup file (use file.C
3466 or file.cc)
3467
3468 - Make variable OPT is passed on to sub-Makefiles
3469
3470 - An init<module>() routine may signal an error by not entering
3471 the module in the module table and raising an exception instead
3472
3473 - For long module names, instead of foobarbletchmodule.c you can
3474 use foobarbletch.c
3475
3476 - getintvalue() and getfloatvalue() try to convert any object
3477 instead of requiring an "intobject" or "floatobject"
3478
3479 - All the [new]getargs() formats that retrieve an integer value
3480 will now also work if a float is passed
3481
3482 - C function listtuple() converts list to tuple, fast
3483
3484 - You should now call sigcheck() instead of intrcheck();
3485 sigcheck() also sets an exception when it returns nonzero
3486
3487
Guido van Rossumaa253861994-10-06 17:18:57 +00003488====================================
3489==> Release 1.0.3 (14 July 1994) <==
3490====================================
3491
3492This release consists entirely of bug fixes to the C sources; see the
3493head of ../ChangeLog for a complete list. Most important bugs fixed:
3494
3495- Sometimes the format operator (string%expr) would drop the last
3496character of the format string
3497
3498- Tokenizer looped when last line did not end in \n
3499
3500- Bug when triple-quoted string ended in quote plus newline
3501
3502- Typo in socketmodule (listen) (== instead of =)
3503
3504- typing vars() at the >>> prompt would cause recursive output
3505
3506
3507==================================
3508==> Release 1.0.2 (4 May 1994) <==
3509==================================
3510
3511Overview of the most visible changes. Bug fixes are not listed. See
3512also ChangeLog.
3513
3514Tokens
3515------
3516
3517* String literals follow Standard C rules: they may be continued on
3518the next line using a backslash; adjacent literals are concatenated
3519at compile time.
3520
3521* A new kind of string literals, surrounded by triple quotes (""" or
3522'''), can be continued on the next line without a backslash.
3523
3524Syntax
3525------
3526
3527* Function arguments may have a default value, e.g. def f(a, b=1);
3528defaults are evaluated at function definition time. This also applies
3529to lambda.
3530
3531* The try-except statement has an optional else clause, which is
3532executed when no exception occurs in the try clause.
3533
3534Interpreter
3535-----------
3536
3537* The result of a statement-level expression is no longer printed,
3538except_ for expressions entered interactively. Consequently, the -k
3539command line option is gone.
3540
3541* The result of the last printed interactive expression is assigned to
3542the variable '_'.
3543
3544* Access to implicit global variables has been speeded up by removing
3545an always-failing dictionary lookup in the dictionary of local
3546variables (mod suggested by Steve Makewski and Tim Peters).
3547
3548* There is a new command line option, -u, to force stdout and stderr
3549to be unbuffered.
3550
3551* Incorporated Steve Majewski's mods to import.c for dynamic loading
3552under AIX.
3553
3554* Fewer chances of dumping core when trying to reload or re-import
3555static built-in, dynamically loaded built-in, or frozen modules.
3556
3557* Loops over sequences now don't ask for the sequence's length when
3558they start, but try to access items 0, 1, 2, and so on until they hit
3559an IndexError. This makes it possible to create classes that generate
3560infinite or indefinite sequences a la Steve Majewski. This affects
3561for loops, the (not) in operator, and the built-in functions filter(),
3562map(), max(), min(), reduce().
3563
3564Changed Built-in operations
3565---------------------------
3566
3567* The '%' operator on strings (printf-style formatting) supports a new
3568feature (adapted from a patch by Donald Beaudry) to allow
3569'%(<key>)<format>' % {...} to take values from a dictionary by name
3570instead of from a tuple by position (see also the new function
3571vars()).
3572
3573* The '%s' formatting operator is changed to accept any type and
3574convert it to a string using str().
3575
3576* Dictionaries with more than 20,000 entries can now be created
3577(thanks to Steve Kirsch).
3578
3579New Built-in Functions
3580----------------------
3581
3582* vars() returns a dictionary containing the local variables; vars(m)
3583returns a dictionary containing the variables of module m. Note:
3584dir(x) is now equivalent to vars(x).keys().
3585
3586Changed Built-in Functions
3587--------------------------
3588
3589* open() has an optional third argument to specify the buffer size: 0
3590for unbuffered, 1 for line buffered, >1 for explicit buffer size, <0
3591for default.
3592
3593* open()'s second argument is now optional; it defaults to "r".
3594
3595* apply() now checks that its second argument is indeed a tuple.
3596
3597New Built-in Modules
3598--------------------
3599
3600Changed Built-in Modules
3601------------------------
3602
3603The thread module no longer supports exit_prog().
3604
3605New Python Modules
3606------------------
3607
3608* Module addpack contains a standard interface to modify sys.path to
3609find optional packages (groups of related modules).
3610
3611* Module urllib contains a number of functions to access
3612World-Wide-Web files specified by their URL.
3613
3614* Module httplib implements the client side of the HTTP protocol used
3615by World-Wide-Web servers.
3616
3617* Module gopherlib implements the client side of the Gopher protocol.
3618
3619* Module mailbox (by Jack Jansen) contains a parser for UNIX and MMDF
3620style mailbox files.
3621
3622* Module random contains various random distributions, e.g. gauss().
3623
3624* Module lockfile locks and unlocks open files using fcntl (inspired
3625by a similar module by Andy Bensky).
3626
3627* Module ntpath (by Jaap Vermeulen) implements path operations for
3628Windows/NT.
3629
3630* Module test_thread (in Lib/test) contains a small test set for the
3631thread module.
3632
3633Changed Python Modules
3634----------------------
3635
3636* The string module's expandvars() function is now documented and is
3637implemented in Python (using regular expressions) instead of forking
3638off a shell process.
3639
3640* Module rfc822 now supports accessing the header fields using the
3641mapping/dictionary interface, e.g. h['subject'].
3642
3643* Module pdb now makes it possible to set a break on a function
3644(syntax: break <expression>, where <expression> yields a function
3645object).
3646
3647Changed Demos
3648-------------
3649
3650* The Demo/scripts/freeze.py script is working again (thanks to Jaap
3651Vermeulen).
3652
3653New Demos
3654---------
3655
3656* Demo/threads/Generator.py is a proposed interface for restartable
3657functions a la Tim Peters.
3658
3659* Demo/scripts/newslist.py, by Quentin Stafford-Fraser, generates a
3660directory full of HTML pages which between them contain links to all
3661the newsgroups available on your server.
3662
3663* Demo/dns contains a DNS (Domain Name Server) client.
3664
3665* Demo/lutz contains miscellaneous demos by Mark Lutz (e.g. psh.py, a
3666nice enhanced Python shell!!!).
3667
3668* Demo/turing contains a Turing machine by Amrit Prem.
3669
3670Documentation
3671-------------
3672
3673* Documented new language features mentioned above (but not all new
3674modules).
3675
3676* Added a chapter to the Tutorial describing recent additions to
3677Python.
3678
3679* Clarified some sentences in the reference manual,
3680e.g. break/continue, local/global scope, slice assignment.
3681
3682Source Structure
3683----------------
3684
3685* Moved Include/tokenizer.h to Parser/tokenizer.h.
3686
3687* Added Python/getopt.c for systems that don't have it.
3688
3689Emacs mode
3690----------
3691
3692* Indentation of continuated lines is done more intelligently;
3693consequently the variable py-continuation-offset is gone.
3694
3695========================================
3696==> Release 1.0.1 (15 February 1994) <==
3697========================================
3698
3699* Many portability fixes should make it painless to build Python on
3700several new platforms, e.g. NeXT, SEQUENT, WATCOM, DOS, and Windows.
3701
3702* Fixed test for <stdarg.h> -- this broke on some platforms.
3703
3704* Fixed test for shared library dynalic loading -- this broke on SunOS
37054.x using the GNU loader.
3706
3707* Changed order and number of SVR4 networking libraries (it is now
3708-lsocket -linet -lnsl, if these libraries exist).
3709
3710* Installing the build intermediate stages with "make libainstall" now
3711also installs config.c.in, Setup and makesetup, which are used by the
3712new Extensions mechanism.
3713
3714* Improved README file contains more hints and new troubleshooting
3715section.
3716
3717* The built-in module strop now defines fast versions of three more
3718functions of the standard string module: atoi(), atol() and atof().
3719The strop versions of atoi() and atol() support an optional second
3720argument to specify the base (default 10). NOTE: you don't have to
3721explicitly import strop to use the faster versions -- the string
3722module contains code to let versions from stop override the default
3723versions.
3724
3725* There is now a working Lib/dospath.py for those who use Python under
3726DOS (or Windows). Thanks, Jaap!
3727
3728* There is now a working Modules/dosmodule.c for DOS (or Windows)
3729system calls.
3730
3731* Lib.os.py has been reorganized (making it ready for more operating
3732systems).
3733
3734* Lib/ospath.py is now obsolete (use os.path instead).
3735
3736* Many fixes to the tutorial to make it match Python 1.0. Thanks,
3737Tim!
3738
3739* Fixed Doc/Makefile, Doc/README and various scripts there.
3740
3741* Added missing description of fdopen to Doc/libposix.tex.
3742
3743* Made cleanup() global, for the benefit of embedded applications.
3744
3745* Added parsing of addresses and dates to Lib/rfc822.py.
3746
3747* Small fixes to Lib/aifc.py, Lib/sunau.py, Lib/tzparse.py to make
3748them usable at all.
3749
3750* New module Lib/wave.py reads RIFF (*.wav) audio files.
3751
3752* Module Lib/filewin.py moved to Lib/stdwin/filewin.py where it
3753belongs.
3754
3755* New options and comments for Modules/makesetup (used by new
3756Extension mechanism).
3757
3758* Misc/HYPE contains text of announcement of 1.0.0 in comp.lang.misc
3759and elsewhere.
3760
3761* Fixed coredump in filter(None, 'abcdefg').
3762
3763
3764=======================================
3765==> Release 1.0.0 (26 January 1994) <==
3766=======================================
3767
3768As is traditional, so many things have changed that I can't pretend to
3769be complete in these release notes, but I'll try anyway :-)
3770
3771Note that the very last section is labeled "remaining bugs".
3772
3773
3774Source organization and build process
3775-------------------------------------
3776
3777* The sources have finally been split: instead of a single src
3778subdirectory there are now separate directories Include, Parser,
3779Grammar, Objects, Python and Modules. Other directories also start
3780with a capital letter: Misc, Doc, Lib, Demo.
3781
3782* A few extensions (notably Amoeba and X support) have been moved to a
3783separate subtree Extensions, which is no longer in the core
3784distribution, but separately ftp'able as extensions.tar.Z. (The
3785distribution contains a placeholder Ext-dummy with a description of
3786the Extensions subtree as well as the most recent versions of the
3787scripts used there.)
3788
3789* A few large specialized demos (SGI video and www) have been
3790moved to a separate subdirectory Demo2, which is no longer in the core
3791distribution, but separately ftp'able as demo2.tar.Z.
3792
3793* Parts of the standard library have been moved to subdirectories:
3794there are now standard subdirectories stdwin, test, sgi and sun4.
3795
3796* The configuration process has radically changed: I now use GNU
3797autoconf. This makes it much easier to build on new Unix flavors, as
3798well as fully supporting VPATH (if your Make has it). The scripts
3799Configure.py and Addmodule.sh are no longer needed. Many source files
3800have been adapted in order to work with the symbols that the configure
3801script generated by autoconf defines (or not); the resulting source is
3802much more portable to different C compilers and operating systems,
3803even non Unix systems (a Mac port was done in an afternoon). See the
3804toplevel README file for a description of the new build process.
3805
3806* GNU readline (a slightly newer version) is now a subdirectory of the
3807Python toplevel. It is still not automatically configured (being
3808totally autoconf-unaware :-). One problem has been solved: typing
3809Control-C to a readline prompt will now work. The distribution no
3810longer contains a "super-level" directory (above the python toplevel
3811directory), and dl, dl-dld and GNU dld are no longer part of the
3812Python distribution (you can still ftp them from
3813ftp.cwi.nl:/pub/dynload).
3814
3815* The DOS functions have been taken out of posixmodule.c and moved
3816into a separate file dosmodule.c.
3817
3818* There's now a separate file version.c which contains nothing but
3819the version number.
3820
3821* The actual main program is now contained in config.c (unless NO_MAIN
3822is defined); pythonmain.c now contains a function realmain() which is
3823called from config.c's main().
3824
3825* All files needed to use the built-in module md5 are now contained in
3826the distribution. The module has been cleaned up considerably.
3827
3828
3829Documentation
3830-------------
3831
3832* The library manual has been split into many more small latex files,
3833so it is easier to edit Doc/lib.tex file to create a custom library
3834manual, describing only those modules supported on your system. (This
3835is not automated though.)
3836
3837* A fourth manual has been added, titled "Extending and Embedding the
3838Python Interpreter" (Doc/ext.tex), which collects information about
3839the interpreter which was previously spread over several files in the
3840misc subdirectory.
3841
3842* The entire documentation is now also available on-line for those who
3843have a WWW browser (e.g. NCSA Mosaic). Point your browser to the URL
3844"http://www.cwi.nl/~guido/Python.html".
3845
3846
3847Syntax
3848------
3849
3850* Strings may now be enclosed in double quotes as well as in single
3851quotes. There is no difference in interpretation. The repr() of
3852string objects will use double quotes if the string contains a single
3853quote and no double quotes. Thanks to Amrit Prem for these changes!
3854
3855* There is a new keyword 'exec'. This replaces the exec() built-in
3856function. If a function contains an exec statement, local variable
3857optimization is not performed for that particular function, thus
3858making assignment to local variables in exec statements less
3859confusing. (As a consequence, os.exec and python.exec have been
3860renamed to execv.)
3861
3862* There is a new keyword 'lambda'. An expression of the form
3863
3864 lambda <parameters> : <expression>
3865
3866yields an anonymous function. This is really only syntactic sugar;
3867you can just as well define a local function using
3868
3869 def some_temporary_name(<parameters>): return <expression>
3870
3871Lambda expressions are particularly useful in combination with map(),
3872filter() and reduce(), described below. Thanks to Amrit Prem for
3873submitting this code (as well as map(), filter(), reduce() and
3874xrange())!
3875
3876
3877Built-in functions
3878------------------
3879
3880* The built-in module containing the built-in functions is called
3881__builtin__ instead of builtin.
3882
3883* New built-in functions map(), filter() and reduce() perform standard
3884functional programming operations (though not lazily):
3885
3886- map(f, seq) returns a new sequence whose items are the items from
3887seq with f() applied to them.
3888
3889- filter(f, seq) returns a subsequence of seq consisting of those
3890items for which f() is true.
3891
3892- reduce(f, seq, initial) returns a value computed as follows:
3893 acc = initial
3894 for item in seq: acc = f(acc, item)
3895 return acc
3896
3897* New function xrange() creates a "range object". Its arguments are
3898the same as those of range(), and when used in a for loop a range
3899objects also behaves identical. The advantage of xrange() over
3900range() is that its representation (if the range contains many
3901elements) is much more compact than that of range(). The disadvantage
3902is that the result cannot be used to initialize a list object or for
3903the "Python idiom" [RED, GREEN, BLUE] = range(3). On some modern
3904architectures, benchmarks have shown that "for i in range(...): ..."
3905actually executes *faster* than "for i in xrange(...): ...", but on
3906memory starved machines like PCs running DOS range(100000) may be just
3907too big to be represented at all...
3908
3909* Built-in function exec() has been replaced by the exec statement --
3910see above.
3911
3912
3913The interpreter
3914---------------
3915
3916* Syntax errors are now not printed to stderr by the parser, but
3917rather the offending line and other relevant information are packed up
3918in the SyntaxError exception argument. When the main loop catches a
3919SyntaxError exception it will print the error in the same format as
3920previously, but at the proper position in the stack traceback.
3921
3922* You can now set a maximum to the number of traceback entries
3923printed by assigning to sys.tracebacklimit. The default is 1000.
3924
3925* The version number in .pyc files has changed yet again.
3926
3927* It is now possible to have a .pyc file without a corresponding .py
3928file. (Warning: this may break existing installations if you have an
3929old .pyc file lingering around somewhere on your module search path
3930without a corresponding .py file, when there is a .py file for a
3931module of the same name further down the path -- the new interpreter
3932will find the first .pyc file and complain about it, while the old
3933interpreter would ignore it and use the .py file further down.)
3934
3935* The list sys.builtin_module_names is now sorted and also contains
3936the names of a few hardwired built-in modules (sys, __main__ and
3937__builtin__).
3938
3939* A module can now find its own name by accessing the global variable
3940__name__. Assigning to this variable essentially renames the module
3941(it should also be stored under a different key in sys.modules).
3942A neat hack follows from this: a module that wants to execute a main
3943program when called as a script no longer needs to compare
3944sys.argv[0]; it can simply do "if __name__ == '__main__': main()".
3945
3946* When an object is printed by the print statement, its implementation
3947of str() is used. This means that classes can define __str__(self) to
3948direct how their instances are printed. This is different from
3949__repr__(self), which should define an unambigous string
3950representation of the instance. (If __str__() is not defined, it
3951defaults to __repr__().)
3952
3953* Functions and code objects can now be compared meaningfully.
3954
3955* On systems supporting SunOS or SVR4 style shared libraries, dynamic
3956loading of modules using shared libraries is automatically configured.
3957Thanks to Bill Jansen and Denis Severson for contributing this change!
3958
3959
3960Built-in objects
3961----------------
3962
3963* File objects have acquired a new method writelines() which is the
3964reverse of readlines(). (It does not actually write lines, just a
3965list of strings, but the symmetry makes the choice of name OK.)
3966
3967
3968Built-in modules
3969----------------
3970
3971* Socket objects no longer support the avail() method. Use the select
3972module instead, or use this function to replace it:
3973
3974 def avail(f):
3975 import select
3976 return f in select.select([f], [], [], 0)[0]
3977
3978* Initialization of stdwin is done differently. It actually modifies
3979sys.argv (taking out the options the X version of stdwin recognizes)
3980the first time it is imported.
3981
3982* A new built-in module parser provides a rudimentary interface to the
3983python parser. Corresponding standard library modules token and symbol
3984defines the numeric values of tokens and non-terminal symbols.
3985
3986* The posix module has aquired new functions setuid(), setgid(),
3987execve(), and exec() has been renamed to execv().
3988
3989* The array module is extended with 8-byte object swaps, the 'i'
3990format character, and a reverse() method. The read() and write()
3991methods are renamed to fromfile() and tofile().
3992
3993* The rotor module has freed of portability bugs. This introduces a
3994backward compatibility problem: strings encoded with the old rotor
3995module can't be decoded by the new version.
3996
3997* For select.select(), a timeout (4th) argument of None means the same
3998as leaving the timeout argument out.
3999
4000* Module strop (and hence standard library module string) has aquired
4001a new function: rindex(). Thanks to Amrit Prem!
4002
4003* Module regex defines a new function symcomp() which uses an extended
4004regular expression syntax: parenthesized subexpressions may be labeled
4005using the form "\(<labelname>...\)", and the group() method can return
4006sub-expressions by name. Thanks to Tracy Tims for these changes!
4007
4008* Multiple threads are now supported on Solaris 2. Thanks to Sjoerd
4009Mullender!
4010
4011
4012Standard library modules
4013------------------------
4014
4015* The library is now split in several subdirectories: all stuff using
4016stdwin is in Lib/stdwin, all SGI specific (or SGI Indigo or GL) stuff
4017is in Lib/sgi, all Sun Sparc specific stuff is in Lib/sun4, and all
4018test modules are in Lib/test. The default module search path will
4019include all relevant subdirectories by default.
4020
4021* Module os now knows about trying to import dos. It defines
4022functions execl(), execle(), execlp() and execvp().
4023
4024* New module dospath (should be attacked by a DOS hacker though).
4025
4026* All modules defining classes now define __init__() constructors
4027instead of init() methods. THIS IS AN INCOMPATIBLE CHANGE!
4028
4029* Some minor changes and bugfixes module ftplib (mostly Steve
4030Majewski's suggestions); the debug() method is renamed to
4031set_debuglevel().
4032
4033* Some new test modules (not run automatically by testall though):
4034test_audioop, test_md5, test_rgbimg, test_select.
4035
4036* Module string now defines rindex() and rfind() in analogy of index()
4037and find(). It also defines atof() and atol() (and corresponding
4038exceptions) in analogy to atoi().
4039
4040* Added help() functions to modules profile and pdb.
4041
4042* The wdb debugger (now in Lib/stdwin) now shows class or instance
4043variables on a double click. Thanks to Sjoerd Mullender!
4044
4045* The (undocumented) module lambda has gone -- you couldn't import it
4046any more, and it was basically more a demo than a library module...
4047
4048
4049Multimedia extensions
4050---------------------
4051
4052* The optional built-in modules audioop and imageop are now standard
4053parts of the interpreter. Thanks to Sjoerd Mullender and Jack Jansen
4054for contributing this code!
4055
4056* There's a new operation in audioop: minmax().
4057
4058* There's a new built-in module called rgbimg which supports portable
4059efficient reading of SGI RCG image files. Thanks also to Paul
4060Haeberli for the original code! (Who will contribute a GIF reader?)
4061
4062* The module aifc is gone -- you should now always use aifc, which has
4063received a facelift.
4064
4065* There's a new module sunau., for reading Sun (and NeXT) audio files.
4066
4067* There's a new module audiodev which provides a uniform interface to
4068(SGI Indigo and Sun Sparc) audio hardware.
4069
4070* There's a new module sndhdr which recognizes various sound files by
4071looking in their header and checking for various magic words.
4072
4073
4074Optimizations
4075-------------
4076
4077* Most optimizations below can be configured by compile-time flags.
4078Thanks to Sjoerd Mullender for submitting these optimizations!
4079
4080* Small integers (default -1..99) are shared -- i.e. if two different
4081functions compute the same value it is possible (but not
4082guaranteed!!!) that they return the same *object*. Python programs
4083can detect this but should *never* rely on it.
4084
4085* Empty tuples (which all compare equal) are shared in the same
4086manner.
4087
4088* Tuples of size up to 20 (default) are put in separate free lists
4089when deallocated.
4090
4091* There is a compile-time option to cache a string's hash function,
4092but this appeared to have a negligeable effect, and as it costs 4
4093bytes per string it is disabled by default.
4094
4095
4096Embedding Python
4097----------------
4098
4099* The initialization interface has been simplified somewhat. You now
4100only call "initall()" to initialize the interpreter.
4101
4102* The previously announced renaming of externally visible identifiers
4103has not been carried out. It will happen in a later release. Sorry.
4104
4105
4106Miscellaneous bugs that have been fixed
4107---------------------------------------
4108
4109* All known portability bugs.
4110
4111* Version 0.9.9 dumped core in <listobject>.sort() which has been
4112fixed. Thanks to Jaap Vermeulen for fixing this and posting the fix
4113on the mailing list while I was away!
4114
4115* Core dump on a format string ending in '%', e.g. in the expression
4116'%' % None.
4117
4118* The array module yielded a bogus result for concatenation (a+b would
4119yield a+a).
4120
4121* Some serious memory leaks in strop.split() and strop.splitfields().
4122
4123* Several problems with the nis module.
4124
4125* Subtle problem when copying a class method from another class
4126through assignment (the method could not be called).
4127
4128
4129Remaining bugs
4130--------------
4131
4132* One problem with 64-bit machines remains -- since .pyc files are
4133portable and use only 4 bytes to represent an integer object, 64-bit
4134integer literals are silently truncated when written into a .pyc file.
4135Work-around: use eval('123456789101112').
4136
4137* The freeze script doesn't work any more. A new and more portable
4138one can probably be cooked up using tricks from Extensions/mkext.py.
4139
4140* The dos support hasn't been tested yet. (Really Soon Now we should
4141have a PC with a working C compiler!)
4142
4143
Guido van Rossuma7925f11994-01-26 10:20:16 +00004144===================================
4145==> Release 0.9.9 (29 Jul 1993) <==
4146===================================
4147
4148I *believe* these are the main user-visible changes in this release,
4149but there may be others. SGI users may scan the {src,lib}/ChangeLog
4150files for improvements of some SGI specific modules, e.g. aifc and
4151cl. Developers of extension modules should also read src/ChangeLog.
4152
4153
4154Naming of C symbols used by the Python interpreter
4155--------------------------------------------------
4156
4157* This is the last release using the current naming conventions. New
4158naming conventions are explained in the file misc/NAMING.
4159Summarizing, all externally visible symbols get (at least) a "Py"
4160prefix, and most functions are renamed to the standard form
4161PyModule_FunctionName.
4162
4163* Writers of extensions are urged to start using the new naming
4164conventions. The next release will use the new naming conventions
4165throughout (it will also have a different source directory
4166structure).
4167
4168* As a result of the preliminary work for the great renaming, many
4169functions that were accidentally global have been made static.
4170
4171
4172BETA X11 support
4173----------------
4174
4175* There are now modules interfacing to the X11 Toolkit Intrinsics, the
4176Athena widgets, and the Motif 1.1 widget set. These are not yet
4177documented except through the examples and README file in the demo/x11
4178directory. It is expected that this interface will be replaced by a
4179more powerful and correct one in the future, which may or may not be
4180backward compatible. In other words, this part of the code is at most
4181BETA level software! (Note: the rest of Python is rock solid as ever!)
4182
4183* I understand that the above may be a bit of a disappointment,
4184however my current schedule does not allow me to change this situation
4185before putting the release out of the door. By releasing it
4186undocumented and buggy, at least some of the (working!) demo programs,
4187like itr (my Internet Talk Radio browser) become available to a larger
4188audience.
4189
4190* There are also modules interfacing to SGI's "Glx" widget (a GL
4191window wrapped in a widget) and to NCSA's "HTML" widget (which can
4192format HyperText Markup Language, the document format used by the
4193World Wide Web).
4194
4195* I've experienced some problems when building the X11 support. In
4196particular, the Xm and Xaw widget sets don't go together, and it
4197appears that using X11R5 is better than using X11R4. Also the threads
4198module and its link time options may spoil things. My own strategy is
4199to build two Python binaries: one for use with X11 and one without
4200it, which can contain a richer set of built-in modules. Don't even
4201*think* of loading the X11 modules dynamically...
4202
4203
4204Environmental changes
4205---------------------
4206
4207* Compiled files (*.pyc files) created by this Python version are
4208incompatible with those created by the previous version. Both
4209versions detect this and silently create a correct version, but it
4210means that it is not a good idea to use the same library directory for
4211an old and a new interpreter, since they will start to "fight" over
4212the *.pyc files...
4213
4214* When a stack trace is printed, the exception is printed last instead
4215of first. This means that if the beginning of the stack trace
4216scrolled out of your window you can still see what exception caused
4217it.
4218
4219* Sometimes interrupting a Python operation does not work because it
4220hangs in a blocking system call. You can now kill the interpreter by
4221interrupting it three times. The second time you interrupt it, a
4222message will be printed telling you that the third interrupt will kill
4223the interpreter. The "sys.exitfunc" feature still makes limited
4224clean-up possible in this case.
4225
4226
4227Changes to the command line interface
4228-------------------------------------
4229
4230* The python usage message is now much more informative.
4231
4232* New option -i enters interactive mode after executing a script --
4233useful for debugging.
4234
4235* New option -k raises an exception when an expression statement
4236yields a value other than None.
4237
4238* For each option there is now also a corresponding environment
4239variable.
4240
4241
4242Using Python as an embedded language
4243------------------------------------
4244
4245* The distribution now contains (some) documentation on the use of
4246Python as an "embedded language" in other applications, as well as a
4247simple example. See the file misc/EMBEDDING and the directory embed/.
4248
4249
4250Speed improvements
4251------------------
4252
4253* Function local variables are now generally stored in an array and
4254accessed using an integer indexing operation, instead of through a
4255dictionary lookup. (This compensates the somewhat slower dictionary
4256lookup caused by the generalization of the dictionary module.)
4257
4258
4259Changes to the syntax
4260---------------------
4261
4262* Continuation lines can now *sometimes* be written without a
4263backslash: if the continuation is contained within nesting (), [] or
4264{} brackets the \ may be omitted. There's a much improved
4265python-mode.el in the misc directory which knows about this as well.
4266
4267* You can no longer use an empty set of parentheses to define a class
4268without base classes. That is, you no longer write this:
4269
4270 class Foo(): # syntax error
4271 ...
4272
4273You must write this instead:
4274
4275 class Foo:
4276 ...
4277
4278This was already the preferred syntax in release 0.9.8 but many
4279people seemed not to have picked it up. There's a Python script that
4280fixes old code: demo/scripts/classfix.py.
4281
4282* There's a new reserved word: "access". The syntax and semantics are
4283still subject of of research and debate (as well as undocumented), but
4284the parser knows about the keyword so you must not use it as a
4285variable, function, or attribute name.
4286
4287
4288Changes to the semantics of the language proper
4289-----------------------------------------------
4290
4291* The following compatibility hack is removed: if a function was
4292defined with two or more arguments, and called with a single argument
4293that was a tuple with just as many arguments, the items of this tuple
4294would be used as the arguments. This is no longer supported.
4295
4296
4297Changes to the semantics of classes and instances
4298-------------------------------------------------
4299
4300* Class variables are now also accessible as instance variables for
4301reading (assignment creates an instance variable which overrides the
4302class variable of the same name though).
4303
4304* If a class attribute is a user-defined function, a new kind of
4305object is returned: an "unbound method". This contains a pointer to
4306the class and can only be called with a first argument which is a
4307member of that class (or a derived class).
4308
4309* If a class defines a method __init__(self, arg1, ...) then this
4310method is called when a class instance is created by the classname()
4311construct. Arguments passed to classname() are passed to the
4312__init__() method. The __init__() methods of base classes are not
4313automatically called; the derived __init__() method must call these if
4314necessary (this was done so the derived __init__() method can choose
4315the call order and arguments for the base __init__() methods).
4316
4317* If a class defines a method __del__(self) then this method is called
4318when an instance of the class is about to be destroyed. This makes it
4319possible to implement clean-up of external resources attached to the
4320instance. As with __init__(), the __del__() methods of base classes
4321are not automatically called. If __del__ manages to store a reference
4322to the object somewhere, its destruction is postponed; when the object
4323is again about to be destroyed its __del__() method will be called
4324again.
4325
4326* Classes may define a method __hash__(self) to allow their instances
4327to be used as dictionary keys. This must return a 32-bit integer.
4328
4329
4330Minor improvements
4331------------------
4332
4333* Function and class objects now know their name (the name given in
4334the 'def' or 'class' statement that created them).
4335
4336* Class instances now know their class name.
4337
4338
4339Additions to built-in operations
4340--------------------------------
4341
4342* The % operator with a string left argument implements formatting
4343similar to sprintf() in C. The right argument is either a single
4344value or a tuple of values. All features of Standard C sprintf() are
4345supported except %p.
4346
4347* Dictionaries now support almost any key type, instead of just
4348strings. (The key type must be an immutable type or must be a class
4349instance where the class defines a method __hash__(), in order to
4350avoid losing track of keys whose value may change.)
4351
4352* Built-in methods are now compared properly: when comparing x.meth1
4353and y.meth2, if x is equal to y and the methods are defined by the
4354same function, x.meth1 compares equal to y.meth2.
4355
4356
4357Additions to built-in functions
4358-------------------------------
4359
4360* str(x) returns a string version of its argument. If the argument is
4361a string it is returned unchanged, otherwise it returns `x`.
4362
4363* repr(x) returns the same as `x`. (Some users found it easier to
4364have this as a function.)
4365
4366* round(x) returns the floating point number x rounded to an whole
4367number, represented as a floating point number. round(x, n) returns x
4368rounded to n digits.
4369
4370* hasattr(x, name) returns true when x has an attribute with the given
4371name.
4372
4373* hash(x) returns a hash code (32-bit integer) of an arbitrary
4374immutable object's value.
4375
4376* id(x) returns a unique identifier (32-bit integer) of an arbitrary
4377object.
4378
4379* compile() compiles a string to a Python code object.
4380
4381* exec() and eval() now support execution of code objects.
4382
4383
4384Changes to the documented part of the library (standard modules)
4385----------------------------------------------------------------
4386
4387* os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so
4388the border case '/foo/..' returns '/' instead of ''.
4389
4390* A new function string.find() is added with similar semantics to
4391string.index(); however when it does not find the given substring it
4392returns -1 instead of raising string.index_error.
4393
4394
4395Changes to built-in modules
4396---------------------------
4397
4398* New optional module 'array' implements operations on sequences of
4399integers or floating point numbers of a particular size. This is
4400useful to manipulate large numerical arrays or to read and write
4401binary files consisting of numerical data.
4402
4403* Regular expression objects created by module regex now support a new
4404method named group(), which returns one or more \(...\) groups by number.
4405The number of groups is increased from 10 to 100.
4406
4407* Function compile() in module regex now supports an optional mapping
4408argument; a variable casefold is added to the module which can be used
4409as a standard uppercase to lowercase mapping.
4410
4411* Module time now supports many routines that are defined in the
4412Standard C time interface (<time.h>): gmtime(), localtime(),
4413asctime(), ctime(), mktime(), as well as these variables (taken from
4414System V): timezone, altzone, daylight and tzname. (The corresponding
4415functions in the undocumented module calendar have been removed; the
4416undocumented and unfinished module tzparse is now obsolete and will
4417disappear in a future release.)
4418
4419* Module strop (the fast built-in version of standard module string)
4420now uses C's definition of whitespace instead of fixing it to space,
4421tab and newline; in practice this usually means that vertical tab,
4422form feed and return are now also considered whitespace. It exports
4423the string of characters that are considered whitespace as well as the
4424characters that are considered lowercase or uppercase.
4425
4426* Module sys now defines the variable builtin_module_names, a list of
4427names of modules built into the current interpreter (including not
4428yet imported, but excluding two special modules that always have to be
4429defined -- sys and builtin).
4430
4431* Objects created by module sunaudiodev now also support flush() and
4432close() methods.
4433
4434* Socket objects created by module socket now support an optional
4435flags argument for their methods sendto() and recvfrom().
4436
4437* Module marshal now supports dumping to and loading from strings,
4438through the functions dumps() and loads().
4439
4440* Module stdwin now supports some new functionality. You may have to
4441ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.)
4442
4443
4444Bugs fixed
4445----------
4446
4447* Fixed comparison of negative long integers.
4448
4449* The tokenizer no longer botches input lines longer than BUFSIZ.
4450
4451* Fixed several severe memory leaks in module select.
4452
4453* Fixed memory leaks in modules socket and sv.
4454
4455* Fixed memory leak in divmod() for long integers.
4456
4457* Problems with definition of floatsleep() on Suns fixed.
4458
4459* Many portability bugs fixed (and undoubtedly new ones added :-).
4460
4461
4462Changes to the build procedure
4463------------------------------
4464
4465* The Makefile supports some new targets: "make default" and "make
4466all". Both are by normally equivalent to "make python".
4467
4468* The Makefile no longer uses $> since it's not supported by all
4469versions of Make.
4470
4471* The header files now all contain #ifdef constructs designed to make
4472it safe to include the same header file twice, as well as support for
4473inclusion from C++ programs (automatic extern "C" { ... } added).
4474
4475
4476Freezing Python scripts
4477-----------------------
4478
4479* There is now some support for "freezing" a Python script as a
4480stand-alone executable binary file. See the script
4481demo/scripts/freeze.py. It will require some site-specific tailoring
4482of the script to get this working, but is quite worthwhile if you write
4483Python code for other who may not have built and installed Python.
4484
4485
4486MS-DOS
4487------
4488
4489* A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks,
4490Marcel van der Peijl! This requires fewer compatibility hacks in
4491posixmodule.c. The executable is not yet available but will be soon
4492(check the mailing list).
4493
4494* The default PYTHONPATH has changed.
4495
4496
4497Changes for developers of extension modules
4498-------------------------------------------
4499
4500* Read src/ChangeLog for full details.
4501
4502
4503SGI specific changes
4504--------------------
4505
4506* Read src/ChangeLog for full details.
4507
Guido van Rossumaa253861994-10-06 17:18:57 +00004508
Guido van Rossuma7925f11994-01-26 10:20:16 +00004509==================================
4510==> Release 0.9.8 (9 Jan 1993) <==
4511==================================
4512
4513I claim no completeness here, but I've tried my best to scan the log
4514files throughout my source tree for interesting bits of news. A more
4515complete account of the changes is to be found in the various
4516ChangeLog files. See also "News for release 0.9.7beta" below if you're
4517still using release 0.9.6, and the file HISTORY if you have an even
4518older release.
4519
4520 --Guido
4521
4522
4523Changes to the language proper
4524------------------------------
4525
4526There's only one big change: the conformance checking for function
4527argument lists (of user-defined functions only) is stricter. Earlier,
4528you could get away with the following:
4529
4530 (a) define a function of one argument and call it with any
4531 number of arguments; if the actual argument count wasn't
4532 one, the function would receive a tuple containing the
4533 arguments arguments (an empty tuple if there were none).
4534
4535 (b) define a function of two arguments, and call it with more
4536 than two arguments; if there were more than two arguments,
4537 the second argument would be passed as a tuple containing
4538 the second and further actual arguments.
4539
4540(Note that an argument (formal or actual) that is a tuple is counted as
4541one; these rules don't apply inside such tuples, only at the top level
4542of the argument list.)
4543
4544Case (a) was needed to accommodate variable-length argument lists;
4545there is now an explicit "varargs" feature (precede the last argument
4546with a '*'). Case (b) was needed for compatibility with old class
4547definitions: up to release 0.9.4 a method with more than one argument
4548had to be declared as "def meth(self, (arg1, arg2, ...)): ...".
4549Version 0.9.6 provide better ways to handle both casees, bot provided
4550backward compatibility; version 0.9.8 retracts the compatibility hacks
4551since they also cause confusing behavior if a function is called with
4552the wrong number of arguments.
4553
4554There's a script that helps converting classes that still rely on (b),
4555provided their methods' first argument is called "self":
4556demo/scripts/methfix.py.
4557
4558If this change breaks lots of code you have developed locally, try
4559#defining COMPAT_HACKS in ceval.c.
4560
4561(There's a third compatibility hack, which is the reverse of (a): if a
4562function is defined with two or more arguments, and called with a
4563single argument that is a tuple with just as many arguments, the items
4564of this tuple will be used as the arguments. Although this can (and
4565should!) be done using the built-in function apply() instead, it isn't
4566withdrawn yet.)
4567
4568
4569One minor change: comparing instance methods works like expected, so
4570that if x is an instance of a user-defined class and has a method m,
4571then (x.m==x.m) yields 1.
4572
4573
4574The following was already present in 0.9.7beta, but not explicitly
4575mentioned in the NEWS file: user-defined classes can now define types
4576that behave in almost allrespects like numbers. See
4577demo/classes/Rat.py for a simple example.
4578
4579
4580Changes to the build process
4581----------------------------
4582
4583The Configure.py script and the Makefile has been made somewhat more
4584bullet-proof, after reports of (minor) trouble on certain platforms.
4585
4586There is now a script to patch Makefile and config.c to add a new
4587optional built-in module: Addmodule.sh. Read the script before using!
4588
4589Useing Addmodule.sh, all optional modules can now be configured at
4590compile time using Configure.py, so there are no modules left that
4591require dynamic loading.
4592
4593The Makefile has been fixed to make it easier to use with the VPATH
4594feature of some Make versions (e.g. SunOS).
4595
4596
4597Changes affecting portability
4598-----------------------------
4599
4600Several minor portability problems have been solved, e.g. "malloc.h"
4601has been renamed to "mymalloc.h", "strdup.c" is no longer used, and
4602the system now tolerates malloc(0) returning 0.
4603
4604For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now
4605distributed with Python. This solves several minor problems, in
4606particular scripts invoked using #! can now use dynamic loading.
4607
4608
4609Changes to the interpreter interface
4610------------------------------------
4611
4612On popular demand, there's finally a "profile" feature for interactive
4613use of the interpreter. If the environment variable $PYTHONSTARTUP is
4614set to the name of an existing file, Python statements in this file
4615are executed when the interpreter is started in interactive mode.
4616
4617There is a new clean-up mechanism, complementing try...finally: if you
4618assign a function object to sys.exitfunc, it will be called when
4619Python exits or receives a SIGTERM or SIGHUP signal.
4620
4621The interpreter is now generally assumed to live in
4622/usr/local/bin/python (as opposed to /usr/local/python). The script
4623demo/scripts/fixps.py will update old scripts in place (you can easily
4624modify it to do other similar changes).
4625
4626Most I/O that uses sys.stdin/stdout/stderr will now use any object
4627assigned to those names as long as the object supports readline() or
4628write() methods.
4629
4630The parser stack has been increased to 500 to accommodate more
4631complicated expressions (7 levels used to be the practical maximum,
4632it's now about 38).
4633
4634The limit on the size of the *run-time* stack has completely been
4635removed -- this means that tuple or list displays can contain any
4636number of elements (formerly more than 50 would crash the
4637interpreter).
4638
4639
4640Changes to existing built-in functions and methods
4641--------------------------------------------------
4642
4643The built-in functions int(), long(), float(), oct() and hex() now
4644also apply to class instalces that define corresponding methods
4645(__int__ etc.).
4646
4647
4648New built-in functions
4649----------------------
4650
4651The new functions str() and repr() convert any object to a string.
4652The function repr(x) is in all respects equivalent to `x` -- some
4653people prefer a function for this. The function str(x) does the same
4654except if x is already a string -- then it returns x unchanged
4655(repr(x) adds quotes and escapes "funny" characters as octal escapes).
4656
4657The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y.
4658
4659
4660Changes to general built-in modules
4661-----------------------------------
4662
4663The time module's functions are more general: time() returns a
4664floating point number and sleep() accepts one. Their accuracies
4665depends on the precision of the system clock. Millisleep is no longer
4666needed (although it still exists for now), but millitimer is still
4667needed since on some systems wall clock time is only available with
4668seconds precision, while a source of more precise time exists that
4669isn't synchronized with the wall clock. (On UNIX systems that support
4670the BSD gettimeofday() function, time.time() is as time.millitimer().)
4671
4672The string representation of a file object now includes an address:
4673'<file 'filename', mode 'r' at #######>' where ###### is a hex number
4674(the object's address) to make it unique.
4675
4676New functions added to posix: nice(), setpgrp(), and if your system
4677supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp().
4678
4679Improvements to the socket module: socket objects have new methods
4680getpeername() and getsockname(), and the {get,set}sockopt methods can
4681now get/set any kind of option using strings built with the new struct
4682module. And there's a new function fromfd() which creates a socket
4683object given a file descriptor (useful for servers started by inetd,
4684which have a socket connected to stdin and stdout).
4685
4686
4687Changes to SGI-specific built-in modules
4688----------------------------------------
4689
4690The FORMS library interface (fl) now requires FORMS 2.1a. Some new
4691functions have been added and some bugs have been fixed.
4692
4693Additions to al (audio library interface): added getname(),
4694getdefault() and getminmax().
4695
4696The gl modules doesn't call "foreground()" when initialized (this
4697caused some problems) like it dit in 0.9.7beta (but not before).
4698There's a new gl function 'gversion() which returns a version string.
4699
4700The interface to sv (Indigo video interface) has totally changed.
4701(Sorry, still no documentation, but see the examples in
4702demo/sgi/{sv,video}.)
4703
4704
4705Changes to standard library modules
4706-----------------------------------
4707
4708Most functions in module string are now much faster: they're actually
4709implemented in C. The module containing the C versions is called
4710"strop" but you should still import "string" since strop doesn't
4711provide all the interfaces defined in string (and strop may be renamed
4712to string when it is complete in a future release).
4713
4714string.index() now accepts an optional third argument giving an index
4715where to start searching in the first argument, so you can find second
4716and further occurrences (this is similar to the regular expression
4717functions in regex).
4718
4719The definition of what string.splitfields(anything, '') should return
4720is changed for the last time: it returns a singleton list containing
4721its whole first argument unchanged. This is compatible with
4722regsub.split() which also ignores empty delimiter matches.
4723
4724posixpath, macpath: added dirname() and normpath() (and basename() to
4725macpath).
4726
4727The mainloop module (for use with stdwin) can now demultiplex input
4728from other sources, as long as they can be polled with select().
4729
4730
4731New built-in modules
4732--------------------
4733
4734Module struct defines functions to pack/unpack values to/from strings
4735representing binary values in native byte order.
4736
4737Module strop implements C versions of many functions from string (see
4738above).
4739
4740Optional module fcntl defines interfaces to fcntl() and ioctl() --
4741UNIX only. (Not yet properly documented -- see however src/fcntl.doc.)
4742
4743Optional module mpz defines an interface to an altaernative long
4744integer implementation, the GNU MPZ library.
4745
4746Optional module md5 uses the GNU MPZ library to calculate MD5
4747signatures of strings.
4748
4749There are also optional new modules specific to SGI machines: imageop
4750defines some simple operations to images represented as strings; sv
4751interfaces to the Indigo video board; cl interfaces to the (yet
4752unreleased) compression library.
4753
4754
4755New standard library modules
4756----------------------------
4757
4758(Unfortunately the following modules are not all documented; read the
4759sources to find out more about them!)
4760
4761autotest: run testall without showing any output unless it differs
4762from the expected output
4763
4764bisect: use bisection to insert or find an item in a sorted list
4765
4766colorsys: defines conversions between various color systems (e.g. RGB
4767<-> YUV)
4768
4769nntplib: a client interface to NNTP servers
4770
4771pipes: utility to construct pipeline from templates, e.g. for
4772conversion from one file format to another using several utilities.
4773
4774regsub: contains three functions that are more or less compatible with
4775awk functions of the same name: sub() and gsub() do string
4776substitution, split() splits a string using a regular expression to
4777define how separators are define.
4778
4779test_types: test operations on the built-in types of Python
4780
4781toaiff: convert various audio file formats to AIFF format
4782
4783tzparse: parse the TZ environment parameter (this may be less general
4784than it could be, let me know if you fix it).
4785
4786(Note that the obsolete module "path" no longer exists.)
4787
4788
4789New SGI-specific library modules
4790--------------------------------
4791
4792CL: constants for use with the built-in compression library interface (cl)
4793
4794Queue: a multi-producer, multi-consumer queue class implemented for
4795use with the built-in thread module
4796
4797SOCKET: constants for use with built-in module socket, e.g. to set/get
4798socket options. This is SGI-specific because the constants to be
4799passed are system-dependent. You can generate a version for your own
4800system by running the script demo/scripts/h2py.py with
4801/usr/include/sys/socket.h as input.
4802
4803cddb: interface to the database used the the CD player
4804
4805torgb: convert various image file types to rgb format (requires pbmplus)
4806
4807
4808New demos
4809---------
4810
4811There's an experimental interface to define Sun RPC clients and
4812servers in demo/rpc.
4813
4814There's a collection of interfaces to WWW, WAIS and Gopher (both
4815Python classes and program providing a user interface) in demo/www.
4816This includes a program texi2html.py which converts texinfo files to
4817HTML files (the format used hy WWW).
4818
4819The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse.
4820
4821For SGI systems, there's a whole collection of programs and classes
4822that make use of the Indigo video board in demo/sgi/{sv,video}. This
4823represents a significant amount of work that we're giving away!
4824
4825There are demos "rsa" and "md5test" that exercise the mpz and md5
4826modules, respectively. The rsa demo is a complete implementation of
4827the RSA public-key cryptosystem!
4828
4829A bunch of games and examples submitted by Stoffel Erasmus have been
4830included in demo/stoffel.
4831
4832There are miscellaneous new files in some existing demo
4833subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py,
4834sgi/al/cmpaf.py, sockets/{mcast,gopher}.py.
4835
4836There are also many minor changes to existing files, but I'm too lazy
4837to run a diff and note the differences -- you can do this yourself if
4838you save the old distribution's demos. One highlight: the
4839stdwin/python.py demo is much improved!
4840
4841
4842Changes to the documentation
4843----------------------------
4844
4845The LaTeX source for the library uses different macros to enable it to
4846be converted to texinfo, and from there to INFO or HTML format so it
4847can be browsed as a hypertext. The net result is that you can now
4848read the Python library documentation in Emacs info mode!
4849
4850
4851Changes to the source code that affect C extension writers
4852----------------------------------------------------------
4853
4854The function strdup() no longer exists (it was used only in one places
4855and is somewhat of a a portability problem sice some systems have the
4856same function in their C library.
4857
4858The functions NEW() and RENEW() allocate one spare byte to guard
4859against a NULL return from malloc(0) being taken for an error, but
4860this should not be relied upon.
4861
4862
4863=========================
4864==> Release 0.9.7beta <==
4865=========================
4866
4867
4868Changes to the language proper
4869------------------------------
4870
4871User-defined classes can now implement operations invoked through
4872special syntax, such as x[i] or `x` by defining methods named
4873__getitem__(self, i) or __repr__(self), etc.
4874
4875
4876Changes to the build process
4877----------------------------
4878
4879Instead of extensive manual editing of the Makefile to select
4880compile-time options, you can now run a Configure.py script.
4881The Makefile as distributed builds a minimal interpreter sufficient to
4882run Configure.py. See also misc/BUILD
4883
4884The Makefile now includes more "utility" targets, e.g. install and
4885tags/TAGS
4886
4887Using the provided strtod.c and strtol.c are now separate options, as
4888on the Sun the provided strtod.c dumps core :-(
4889
4890The regex module is now an option chosen by the Makefile, since some
4891(old) C compilers choke on regexpr.c
4892
4893
4894Changes affecting portability
4895-----------------------------
4896
4897You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin
4898interface
4899
4900Dynamic loading is now supported for Sun (and other non-COFF systems)
4901throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's
4902DL is out, 1.4)
4903
4904The system-dependent code for the use of the select() system call is
4905moved to one file: myselect.h
4906
4907Thanks to Jaap Vermeulen, the code should now port cleanly to the
4908SEQUENT
4909
4910
4911Changes to the interpreter interface
4912------------------------------------
4913
4914The interpretation of $PYTHONPATH in the environment is different: it
4915is inserted in front of the default path instead of overriding it
4916
4917
4918Changes to existing built-in functions and methods
4919--------------------------------------------------
4920
4921List objects now support an optional argument to their sort() method,
4922which is a comparison function similar to qsort(3) in C
4923
4924File objects now have a method fileno(), used by the new select module
4925(see below)
4926
4927
4928New built-in function
4929---------------------
4930
4931coerce(x, y): take two numbers and return a tuple containing them
4932both converted to a common type
4933
4934
4935Changes to built-in modules
4936---------------------------
4937
4938sys: fixed core dumps in settrace() and setprofile()
4939
4940socket: added socket methods setsockopt() and getsockopt(); and
4941fileno(), used by the new select module (see below)
4942
4943stdwin: added fileno() == connectionnumber(), in support of new module
4944select (see below)
4945
4946posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function.
4947
4948gl: added qgetfd()
4949
4950fl: added several new functions, fixed several obscure bugs, adapted
4951to FORMS 2.1
4952
4953
4954Changes to standard modules
4955---------------------------
4956
4957posixpath: changed implementation of ismount()
4958
4959string: atoi() no longer mistakes leading zero for octal number
4960
4961...
4962
4963
4964New built-in modules
4965--------------------
4966
4967Modules marked "dynamic only" are not configured at compile time but
4968can be loaded dynamically. You need to turn on the DL or DLD option in
4969the Makefile for support dynamic loading of modules (this requires
4970external code).
4971
4972select: interfaces to the BSD select() system call
4973
4974dbm: interfaces to the (new) dbm library (dynamic only)
4975
4976nis: interfaces to some NIS functions (aka yellow pages)
4977
4978thread: limited form of multiple threads (sgi only)
4979
4980audioop: operations useful for audio programs, e.g. u-LAW and ADPCM
4981coding (dynamic only)
4982
4983cd: interface to Indigo SCSI CDROM player audio library (sgi only)
4984
4985jpeg: read files in JPEG format (dynamic only, sgi only; needs
4986external code)
4987
4988imgfile: read SGI image files (dynamic only, sgi only)
4989
4990sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only)
4991
4992sv: interface to Indigo video library (sgi only)
4993
4994pc: a minimal set of MS-DOS interfaces (MS-DOS only)
4995
4996rotor: encryption, by Lance Ellinghouse (dynamic only)
4997
4998
4999New standard modules
5000--------------------
5001
5002Not all these modules are documented. Read the source:
5003lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains
5004additional documentation.
5005
5006imghdr: recognizes image file headers
5007
5008sndhdr: recognizes sound file headers
5009
5010profile: print run-time statistics of Python code
5011
5012readcd, cdplayer: companion modules for built-in module cd (sgi only)
5013
5014emacs: interface to Emacs using py-connect.el (see below).
5015
5016SOCKET: symbolic constant definitions for socket options
5017
5018SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only)
5019
5020SV: symbolic constat definitions for sv (sgi only)
5021
5022CD: symbolic constat definitions for cd (sgi only)
5023
5024
5025New demos
5026---------
5027
5028scripts/pp.py: execute Python as a filter with a Perl-like command
5029line interface
5030
5031classes/: examples using the new class features
5032
5033threads/: examples using the new thread module
5034
5035sgi/cd/: examples using the new cd module
5036
5037
5038Changes to the documentation
5039----------------------------
5040
5041The last-minute syntax changes of release 0.9.6 are now reflected
5042everywhere in the manuals
5043
5044The reference manual has a new section (3.2) on implementing new kinds
5045of numbers, sequences or mappings with user classes
5046
5047Classes are now treated extensively in the tutorial (chapter 9)
5048
5049Slightly restructured the system-dependent chapters of the library
5050manual
5051
5052The file misc/EXTENDING incorporates documentation for mkvalue() and
5053a new section on error handling
5054
5055The files misc/CLASSES and misc/ERRORS are no longer necessary
5056
5057The doc/Makefile now creates PostScript files automatically
5058
5059
5060Miscellaneous changes
5061---------------------
5062
5063Incorporated Tim Peters' changes to python-mode.el, it's now version
50641.06
5065
5066A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python
5067program running in an Emacs buffer execute Emacs lisp code. The
5068necessary Python code is in lib/emacs.py. The Emacs code is
5069misc/py-connect.el (it needs some external Emacs lisp code)
5070
5071
5072Changes to the source code that affect C extension writers
5073----------------------------------------------------------
5074
5075New service function mkvalue() to construct a Python object from C
5076values according to a "format" string a la getargs()
5077
5078Most functions from pythonmain.c moved to new pythonrun.c which is
5079in libpython.a. This should make embedded versions of Python easier
5080
5081ceval.h is split in eval.h (which needs compile.h and only declares
5082eval_code) and ceval.h (which doesn't need compile.hand declares the
5083rest)
5084
5085ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to
5086improve the parallellism of multi-threaded programs by letting other
5087Python code run when a blocking system call or something similar is
5088made)
5089
5090In structmember.[ch], new member types BYTE, CHAR and unsigned
5091variants have been added
5092
5093New file xxmodule.c is a template for new extension modules.
5094
Guido van Rossumaa253861994-10-06 17:18:57 +00005095
Guido van Rossuma7925f11994-01-26 10:20:16 +00005096==================================
5097==> RELEASE 0.9.6 (6 Apr 1992) <==
5098==================================
5099
5100Misc news in 0.9.6:
5101- Restructured the misc subdirectory
5102- Reference manual completed, library manual much extended (with indexes!)
5103- the GNU Readline library is now distributed standard with Python
5104- the script "../demo/scripts/classfix.py" fixes Python modules using old
5105 class syntax
5106- Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!)
5107- Because of the GNU copyleft business I am not using the GNU regular
5108 expression implementation but a free re-implementation by Tatu Ylonen
5109 that recently appeared in comp.sources.misc (Bravo, Tatu!)
5110
5111New features in 0.9.6:
5112- stricter try stmt syntax: cannot mix except and finally clauses on 1 try
5113- New module 'os' supplants modules 'mac' and 'posix' for most cases;
5114 module 'path' is replaced by 'os.path'
5115- os.path.split() return value differs from that of old path.split()
5116- sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception
5117 currently being handled
5118- sys.last_type, sys.last_value, sys.last_traceback remember last unhandled
5119 exception
5120- New function string.expandtabs() expands tabs in a string
5121- Added times() interface to posix (user & sys time of process & children)
5122- Added uname() interface to posix (returns OS type, hostname, etc.)
5123- New built-in function execfile() is like exec() but from a file
5124- Functions exec() and eval() are less picky about whitespace/newlines
5125- New built-in functions getattr() and setattr() access arbitrary attributes
5126- More generic argument handling in built-in functions (see "./EXTENDING")
5127- Dynamic loading of modules written in C or C++ (see "./DYNLOAD")
5128- Division and modulo for long and plain integers with negative operands
5129 have changed; a/b is now floor(float(a)/float(b)) and a%b is defined
5130 as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as
5131 (a/b, a%b) for integers. For floats, % is also changed, but of course
5132 / is unchanged, and divmod(x,y) does not yield (x/y, x%y)...
5133- A function with explicit variable-length argument list can be declared
5134 like this: def f(*args): ...; or even like this: def f(a, b, *rest): ...
5135- Code tracing and profiling features have been added, and two source
5136 code debuggers are provided in the library (pdb.py, tty-oriented,
5137 and wdb, window-oriented); you can now step through Python programs!
5138 See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc"
5139- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is
5140 a script that fixes old Python modules
5141- Plain integer right shift now uses sign extension
5142- Long integer shift/mask operations now simulate 2's complement
5143 to give more useful results for negative operands
5144- Changed/added range checks for long/plain integer shifts
5145- Options found after "-c command" are now passed to the command in sys.argv
5146 (note subtle incompatiblity with "python -c command -- -options"!)
5147- Module stdwin is better protected against touching objects after they've
5148 been closed; menus can now also be closed explicitly
5149- Stdwin now uses its own exception (stdwin.error)
5150
5151New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992):
5152- dictionary objects can now be compared properly; e.g., {}=={} is true
5153- new exception SystemExit causes termination if not caught;
5154 it is raised by sys.exit() so that 'finally' clauses can clean up,
5155 and it may even be caught. It does work interactively!
5156- new module "regex" implements GNU Emacs style regular expressions;
5157 module "regexp" is rewritten in Python for backward compatibility
5158- formal parameter lists may contain trailing commas
5159
5160Bugs fixed in 0.9.6:
5161- assigning to or deleting a list item with a negative index dumped core
5162- divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L)
5163
5164Bugs fixed in 0.9.5:
5165- masking operations involving negative long integers gave wrong results
5166
5167
5168===================================
5169==> RELEASE 0.9.4 (24 Dec 1991) <==
5170===================================
5171
5172- new function argument handling (see below)
5173- built-in apply(func, args) means func(args[0], args[1], ...)
5174- new, more refined exceptions
5175- new exception string values (NameError = 'NameError' etc.)
5176- better checking for math exceptions
5177- for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i]
5178- fixed list assignment bug: "a[1:1] = a" now works correctly
5179- new class syntax, without extraneous parentheses
5180- new 'global' statement to assign global variables from within a function
5181
5182
5183New class syntax
5184----------------
5185
5186You can now declare a base class as follows:
5187
5188 class B: # Was: class B():
5189 def some_method(self): ...
5190 ...
5191
5192and a derived class thusly:
5193
5194 class D(B): # Was: class D() = B():
5195 def another_method(self, arg): ...
5196
5197Multiple inheritance looks like this:
5198
5199 class M(B, D): # Was: class M() = B(), D():
5200 def this_or_that_method(self, arg): ...
5201
5202The old syntax is still accepted by Python 0.9.4, but will disappear
5203in Python 1.0 (to be posted to comp.sources).
5204
5205
5206New 'global' statement
5207----------------------
5208
5209Every now and then you have a global variable in a module that you
5210want to change from within a function in that module -- say, a count
5211of calls to a function, or an option flag, etc. Until now this was
5212not directly possible. While several kludges are known that
5213circumvent the problem, and often the need for a global variable can
5214be avoided by rewriting the module as a class, this does not always
5215lead to clearer code.
5216
5217The 'global' statement solves this dilemma. Its occurrence in a
5218function body means that, for the duration of that function, the
5219names listed there refer to global variables. For instance:
5220
5221 total = 0.0
5222 count = 0
5223
5224 def add_to_total(amount):
5225 global total, count
5226 total = total + amount
5227 count = count + 1
5228
5229'global' must be repeated in each function where it is needed. The
5230names listed in a 'global' statement must not be used in the function
5231before the statement is reached.
5232
5233Remember that you don't need to use 'global' if you only want to *use*
5234a global variable in a function; nor do you need ot for assignments to
5235parts of global variables (e.g., list or dictionary items or
5236attributes of class instances). This has not changed; in fact
5237assignment to part of a global variable was the standard workaround.
5238
5239
5240New exceptions
5241--------------
5242
5243Several new exceptions have been defined, to distinguish more clearly
5244between different types of errors.
5245
5246name meaning was
5247
5248AttributeError reference to non-existing attribute NameError
5249IOError unexpected I/O error RuntimeError
5250ImportError import of non-existing module or name NameError
5251IndexError invalid string, tuple or list index RuntimeError
5252KeyError key not in dictionary RuntimeError
5253OverflowError numeric overflow RuntimeError
5254SyntaxError invalid syntax RuntimeError
5255ValueError invalid argument value RuntimeError
5256ZeroDivisionError division by zero RuntimeError
5257
5258The string value of each exception is now its name -- this makes it
5259easier to experimentally find out which operations raise which
5260exceptions; e.g.:
5261
5262 >>> KeyboardInterrupt
5263 'KeyboardInterrupt'
5264 >>>
5265
5266
5267New argument passing semantics
5268------------------------------
5269
5270Off-line discussions with Steve Majewski and Daniel LaLiberte have
5271convinced me that Python's parameter mechanism could be changed in a
5272way that made both of them happy (I hope), kept me happy, fixed a
5273number of outstanding problems, and, given some backward compatibility
5274provisions, would only break a very small amount of existing code --
5275probably all mine anyway. In fact I suspect that most Python users
5276will hardly notice the difference. And yet it has cost me at least
5277one sleepless night to decide to make the change...
5278
5279Philosophically, the change is quite radical (to me, anyway): a
5280function is no longer called with either zero or one argument, which
5281is a tuple if there appear to be more arguments. Every function now
5282has an argument list containing 0, 1 or more arguments. This list is
5283always implemented as a tuple, and it is a (run-time) error if a
5284function is called with a different number of arguments than expected.
5285
5286What's the difference? you may ask. The answer is, very little unless
5287you want to write variadic functions -- functions that may be called
5288with a variable number of arguments. Formerly, you could write a
5289function that accepted one or more arguments with little trouble, but
5290writing a function that could be called with either 0 or 1 argument
5291(or more) was next to impossible. This is now a piece of cake: you
5292can simply declare an argument that receives the entire argument
5293tuple, and check its length -- it will be of size 0 if there are no
5294arguments.
5295
5296Another anomaly of the old system was the way multi-argument methods
5297(in classes) had to be declared, e.g.:
5298
5299 class Point():
5300 def init(self, (x, y, color)): ...
5301 def setcolor(self, color): ...
5302 dev moveto(self, (x, y)): ...
5303 def draw(self): ...
5304
5305Using the new scheme there is no need to enclose the method arguments
5306in an extra set of parentheses, so the above class could become:
5307
5308 class Point:
5309 def init(self, x, y, color): ...
5310 def setcolor(self, color): ...
5311 dev moveto(self, x, y): ...
5312 def draw(self): ...
5313
5314That is, the equivalence rule between methods and functions has
5315changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y)
5316while formerly it was equivalent to Point.moveto(p,(x,y)).
5317
5318A special backward compatibility rule makes that the old version also
5319still works: whenever a function with exactly two arguments (at the top
5320level) is called with more than two arguments, the second and further
5321arguments are packed into a tuple and passed as the second argument.
5322This rule is invoked independently of whether the function is actually a
5323method, so there is a slight chance that some erroneous calls of
5324functions expecting two arguments with more than that number of
5325arguments go undetected at first -- when the function tries to use the
5326second argument it may find it is a tuple instead of what was expected.
5327Note that this rule will be removed from future versions of the
5328language; it is a backward compatibility provision *only*.
5329
5330Two other rules and a new built-in function handle conversion between
5331tuples and argument lists:
5332
5333Rule (a): when a function with more than one argument is called with a
5334single argument that is a tuple of the right size, the tuple's items
5335are used as arguments.
5336
5337Rule (b): when a function with exactly one argument receives no
5338arguments or more than one, that one argument will receive a tuple
5339containing the arguments (the tuple will be empty if there were no
5340arguments).
5341
5342
5343A new built-in function, apply(), was added to support functions that
5344need to call other functions with a constructed argument list. The call
5345
5346 apply(function, tuple)
5347
5348is equivalent to
5349
5350 function(tuple[0], tuple[1], ..., tuple[len(tuple)-1])
5351
5352
5353While no new argument syntax was added in this phase, it would now be
5354quite sensible to add explicit syntax to Python for default argument
5355values (as in C++ or Modula-3), or a "rest" argument to receive the
5356remaining arguments of a variable-length argument list.
5357
5358
5359========================================================
5360==> Release 0.9.3 (never made available outside CWI) <==
5361========================================================
5362
5363- string sys.version shows current version (also printed on interactive entry)
5364- more detailed exceptions, e.g., IOError, ZeroDivisionError, etc.
5365- 'global' statement to declare module-global variables assigned in functions.
5366- new class declaration syntax: class C(Base1, Base2, ...): suite
5367 (the old syntax is still accepted -- be sure to convert your classes now!)
5368- C shifting and masking operators: << >> ~ & ^ | (for ints and longs).
5369- C comparison operators: == != (the old = and <> remain valid).
5370- floating point numbers may now start with a period (e.g., .14).
5371- definition of integer division tightened (always truncates towards zero).
5372- new builtins hex(x), oct(x) return hex/octal string from (long) integer.
5373- new list method l.count(x) returns the number of occurrences of x in l.
5374- new SGI module: al (Indigo and 4D/35 audio library).
5375- the FORMS interface (modules fl and FL) now uses FORMS 2.0
5376- module gl: added lrect{read,write}, rectzoom and pixmode;
5377 added (non-GL) functions (un)packrect.
5378- new socket method: s.allowbroadcast(flag).
5379- many objects support __dict__, __methods__ or __members__.
5380- dir() lists anything that has __dict__.
5381- class attributes are no longer read-only.
5382- classes support __bases__, instances support __class__ (and __dict__).
5383- divmod() now also works for floats.
5384- fixed obscure bug in eval('1 ').
5385
5386
5387===================================
5388==> Release 0.9.2 (Autumn 1991) <==
5389===================================
5390
5391Highlights
5392----------
5393
5394- tutorial now (almost) complete; library reference reorganized
5395- new syntax: continue statement; semicolons; dictionary constructors;
5396 restrictions on blank lines in source files removed
5397- dramatically improved module load time through precompiled modules
5398- arbitrary precision integers: compute 2 to the power 1000 and more...
5399- arithmetic operators now accept mixed type operands, e.g., 3.14/4
5400- more operations on list: remove, index, reverse; repetition
5401- improved/new file operations: readlines, seek, tell, flush, ...
5402- process management added to the posix module: fork/exec/wait/kill etc.
5403- BSD socket operations (with example servers and clients!)
5404- many new STDWIN features (color, fonts, polygons, ...)
5405- new SGI modules: font manager and FORMS library interface
5406
5407
5408Extended list of changes in 0.9.2
5409---------------------------------
5410
5411Here is a summary of the most important user-visible changes in 0.9.2,
5412in somewhat arbitrary order. Changes in later versions are listed in
5413the "highlights" section above.
5414
5415
54161. Changes to the interpreter proper
5417
5418- Simple statements can now be separated by semicolons.
5419 If you write "if t: s1; s2", both s1 and s2 are executed
5420 conditionally.
5421- The 'continue' statement was added, with semantics as in C.
5422- Dictionary displays are now allowed on input: {key: value, ...}.
5423- Blank lines and lines bearing only a comment no longer need to
5424 be indented properly. (A completely empty line still ends a multi-
5425 line statement interactively.)
5426- Mixed arithmetic is supported, 1 compares equal to 1.0, etc.
5427- Option "-c command" to execute statements from the command line
5428- Compiled versions of modules are cached in ".pyc" files, giving a
5429 dramatic improvement of start-up time
5430- Other, smaller speed improvements, e.g., extracting characters from
5431 strings, looking up single-character keys, and looking up global
5432 variables
5433- Interrupting a print operation raises KeyboardInterrupt instead of
5434 only cancelling the print operation
5435- Fixed various portability problems (it now passes gcc with only
5436 warnings -- more Standard C compatibility will be provided in later
5437 versions)
5438- Source is prepared for porting to MS-DOS
5439- Numeric constants are now checked for overflow (this requires
5440 standard-conforming strtol() and strtod() functions; a correct
5441 strtol() implementation is provided, but the strtod() provided
5442 relies on atof() for everything, including error checking
5443
5444
54452. Changes to the built-in types, functions and modules
5446
5447- New module socket: interface to BSD socket primitives
5448- New modules pwd and grp: access the UNIX password and group databases
5449- (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager
5450- (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library
5451- New numeric type: long integer, for unlimited precision
5452 - integer constants suffixed with 'L' or 'l' are long integers
5453 - new built-in function long(x) converts int or float to long
5454 - int() and float() now also convert from long integers
5455- New built-in function:
5456 - pow(x, y) returns x to the power y
5457- New operation and methods for lists:
5458 - l*n returns a new list consisting of n concatenated copies of l
5459 - l.remove(x) removes the first occurrence of the value x from l
5460 - l.index(x) returns the index of the first occurrence of x in l
5461 - l.reverse() reverses l in place
5462- New operation for tuples:
5463 - t*n returns a tuple consisting of n concatenated copies of t
5464- Improved file handling:
5465 - f.readline() no longer restricts the line length, is faster,
5466 and isn't confused by null bytes; same for raw_input()
5467 - f.read() without arguments reads the entire (rest of the) file
5468 - mixing of print and sys.stdout.write() has different effect
5469- New methods for files:
5470 - f.readlines() returns a list containing the lines of the file,
5471 as read with f.readline()
5472 - f.flush(), f.tell(), f.seek() call their stdio counterparts
5473 - f.isatty() tests for "tty-ness"
5474- New posix functions:
5475 - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait()
5476 - popen() returns a file object connected to a pipe
5477 - utime() replaces utimes() (the latter is not a POSIX name)
5478- New stdwin features, including:
5479 - font handling
5480 - color drawing
5481 - scroll bars made optional
5482 - polygons
5483 - filled and xor shapes
5484 - text editing objects now have a 'settext' method
5485
5486
54873. Changes to the standard library
5488
5489- Name change: the functions path.cat and macpath.cat are now called
5490 path.join and macpath.join
5491- Added new modules: formatter, mutex, persist, sched, mainloop
5492- Added some modules and functionality to the "widget set" (which is
5493 still under development, so please bear with me):
5494 DirList, FormSplit, TextEdit, WindowSched
5495- Fixed module testall to work non-interactively
5496- Module string:
5497 - added functions join() and joinfields()
5498 - fixed center() to work correct and make it "transitive"
5499- Obsolete modules were removed: util, minmax
5500- Some modules were moved to the demo directory
5501
5502
55034. Changes to the demonstration programs
5504
5505- Added new useful scipts: byteyears, eptags, fact, from, lfact,
5506 objgraph, pdeps, pi, primes, ptags, which
5507- Added a bunch of socket demos
5508- Doubled the speed of ptags
5509- Added new stdwin demos: microedit, miniedit
5510- Added a windowing interface to the Python interpreter: python (most
5511 useful on the Mac)
5512- Added a browser for Emacs info files: demo/stdwin/ibrowse
5513 (yes, I plan to put all STDWIN and Python documentation in texinfo
5514 form in the future)
5515
5516
55175. Other changes to the distribution
5518
5519- An Emacs Lisp file "python.el" is provided to facilitate editing
5520 Python programs in GNU Emacs (slightly improved since posted to
5521 gnu.emacs.sources)
5522- Some info on writing an extension in C is provided
5523- Some info on building Python on non-UNIX platforms is provided
5524
5525
5526=====================================
5527==> Release 0.9.1 (February 1991) <==
5528=====================================
5529
5530- Micro changes only
5531- Added file "patchlevel.h"
5532
5533
5534=====================================
5535==> Release 0.9.0 (February 1991) <==
5536=====================================
5537
5538Original posting to alt.sources.