Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame^] | 1 | Python history |
| 2 | -------------- |
| 3 | |
| 4 | This file contains the release messages for previous Python releases |
| 5 | (slightly edited to adapt them to the format of this file). As you |
| 6 | read on you go back to the dark ages of Python's history. |
| 7 | |
| 8 | =================================== |
| 9 | ==> Release 0.9.9 (29 Jul 1993) <== |
| 10 | =================================== |
| 11 | |
| 12 | I *believe* these are the main user-visible changes in this release, |
| 13 | but there may be others. SGI users may scan the {src,lib}/ChangeLog |
| 14 | files for improvements of some SGI specific modules, e.g. aifc and |
| 15 | cl. Developers of extension modules should also read src/ChangeLog. |
| 16 | |
| 17 | |
| 18 | Naming of C symbols used by the Python interpreter |
| 19 | -------------------------------------------------- |
| 20 | |
| 21 | * This is the last release using the current naming conventions. New |
| 22 | naming conventions are explained in the file misc/NAMING. |
| 23 | Summarizing, all externally visible symbols get (at least) a "Py" |
| 24 | prefix, and most functions are renamed to the standard form |
| 25 | PyModule_FunctionName. |
| 26 | |
| 27 | * Writers of extensions are urged to start using the new naming |
| 28 | conventions. The next release will use the new naming conventions |
| 29 | throughout (it will also have a different source directory |
| 30 | structure). |
| 31 | |
| 32 | * As a result of the preliminary work for the great renaming, many |
| 33 | functions that were accidentally global have been made static. |
| 34 | |
| 35 | |
| 36 | BETA X11 support |
| 37 | ---------------- |
| 38 | |
| 39 | * There are now modules interfacing to the X11 Toolkit Intrinsics, the |
| 40 | Athena widgets, and the Motif 1.1 widget set. These are not yet |
| 41 | documented except through the examples and README file in the demo/x11 |
| 42 | directory. It is expected that this interface will be replaced by a |
| 43 | more powerful and correct one in the future, which may or may not be |
| 44 | backward compatible. In other words, this part of the code is at most |
| 45 | BETA level software! (Note: the rest of Python is rock solid as ever!) |
| 46 | |
| 47 | * I understand that the above may be a bit of a disappointment, |
| 48 | however my current schedule does not allow me to change this situation |
| 49 | before putting the release out of the door. By releasing it |
| 50 | undocumented and buggy, at least some of the (working!) demo programs, |
| 51 | like itr (my Internet Talk Radio browser) become available to a larger |
| 52 | audience. |
| 53 | |
| 54 | * There are also modules interfacing to SGI's "Glx" widget (a GL |
| 55 | window wrapped in a widget) and to NCSA's "HTML" widget (which can |
| 56 | format HyperText Markup Language, the document format used by the |
| 57 | World Wide Web). |
| 58 | |
| 59 | * I've experienced some problems when building the X11 support. In |
| 60 | particular, the Xm and Xaw widget sets don't go together, and it |
| 61 | appears that using X11R5 is better than using X11R4. Also the threads |
| 62 | module and its link time options may spoil things. My own strategy is |
| 63 | to build two Python binaries: one for use with X11 and one without |
| 64 | it, which can contain a richer set of built-in modules. Don't even |
| 65 | *think* of loading the X11 modules dynamically... |
| 66 | |
| 67 | |
| 68 | Environmental changes |
| 69 | --------------------- |
| 70 | |
| 71 | * Compiled files (*.pyc files) created by this Python version are |
| 72 | incompatible with those created by the previous version. Both |
| 73 | versions detect this and silently create a correct version, but it |
| 74 | means that it is not a good idea to use the same library directory for |
| 75 | an old and a new interpreter, since they will start to "fight" over |
| 76 | the *.pyc files... |
| 77 | |
| 78 | * When a stack trace is printed, the exception is printed last instead |
| 79 | of first. This means that if the beginning of the stack trace |
| 80 | scrolled out of your window you can still see what exception caused |
| 81 | it. |
| 82 | |
| 83 | * Sometimes interrupting a Python operation does not work because it |
| 84 | hangs in a blocking system call. You can now kill the interpreter by |
| 85 | interrupting it three times. The second time you interrupt it, a |
| 86 | message will be printed telling you that the third interrupt will kill |
| 87 | the interpreter. The "sys.exitfunc" feature still makes limited |
| 88 | clean-up possible in this case. |
| 89 | |
| 90 | |
| 91 | Changes to the command line interface |
| 92 | ------------------------------------- |
| 93 | |
| 94 | * The python usage message is now much more informative. |
| 95 | |
| 96 | * New option -i enters interactive mode after executing a script -- |
| 97 | useful for debugging. |
| 98 | |
| 99 | * New option -k raises an exception when an expression statement |
| 100 | yields a value other than None. |
| 101 | |
| 102 | * For each option there is now also a corresponding environment |
| 103 | variable. |
| 104 | |
| 105 | |
| 106 | Using Python as an embedded language |
| 107 | ------------------------------------ |
| 108 | |
| 109 | * The distribution now contains (some) documentation on the use of |
| 110 | Python as an "embedded language" in other applications, as well as a |
| 111 | simple example. See the file misc/EMBEDDING and the directory embed/. |
| 112 | |
| 113 | |
| 114 | Speed improvements |
| 115 | ------------------ |
| 116 | |
| 117 | * Function local variables are now generally stored in an array and |
| 118 | accessed using an integer indexing operation, instead of through a |
| 119 | dictionary lookup. (This compensates the somewhat slower dictionary |
| 120 | lookup caused by the generalization of the dictionary module.) |
| 121 | |
| 122 | |
| 123 | Changes to the syntax |
| 124 | --------------------- |
| 125 | |
| 126 | * Continuation lines can now *sometimes* be written without a |
| 127 | backslash: if the continuation is contained within nesting (), [] or |
| 128 | {} brackets the \ may be omitted. There's a much improved |
| 129 | python-mode.el in the misc directory which knows about this as well. |
| 130 | |
| 131 | * You can no longer use an empty set of parentheses to define a class |
| 132 | without base classes. That is, you no longer write this: |
| 133 | |
| 134 | class Foo(): # syntax error |
| 135 | ... |
| 136 | |
| 137 | You must write this instead: |
| 138 | |
| 139 | class Foo: |
| 140 | ... |
| 141 | |
| 142 | This was already the preferred syntax in release 0.9.8 but many |
| 143 | people seemed not to have picked it up. There's a Python script that |
| 144 | fixes old code: demo/scripts/classfix.py. |
| 145 | |
| 146 | * There's a new reserved word: "access". The syntax and semantics are |
| 147 | still subject of of research and debate (as well as undocumented), but |
| 148 | the parser knows about the keyword so you must not use it as a |
| 149 | variable, function, or attribute name. |
| 150 | |
| 151 | |
| 152 | Changes to the semantics of the language proper |
| 153 | ----------------------------------------------- |
| 154 | |
| 155 | * The following compatibility hack is removed: if a function was |
| 156 | defined with two or more arguments, and called with a single argument |
| 157 | that was a tuple with just as many arguments, the items of this tuple |
| 158 | would be used as the arguments. This is no longer supported. |
| 159 | |
| 160 | |
| 161 | Changes to the semantics of classes and instances |
| 162 | ------------------------------------------------- |
| 163 | |
| 164 | * Class variables are now also accessible as instance variables for |
| 165 | reading (assignment creates an instance variable which overrides the |
| 166 | class variable of the same name though). |
| 167 | |
| 168 | * If a class attribute is a user-defined function, a new kind of |
| 169 | object is returned: an "unbound method". This contains a pointer to |
| 170 | the class and can only be called with a first argument which is a |
| 171 | member of that class (or a derived class). |
| 172 | |
| 173 | * If a class defines a method __init__(self, arg1, ...) then this |
| 174 | method is called when a class instance is created by the classname() |
| 175 | construct. Arguments passed to classname() are passed to the |
| 176 | __init__() method. The __init__() methods of base classes are not |
| 177 | automatically called; the derived __init__() method must call these if |
| 178 | necessary (this was done so the derived __init__() method can choose |
| 179 | the call order and arguments for the base __init__() methods). |
| 180 | |
| 181 | * If a class defines a method __del__(self) then this method is called |
| 182 | when an instance of the class is about to be destroyed. This makes it |
| 183 | possible to implement clean-up of external resources attached to the |
| 184 | instance. As with __init__(), the __del__() methods of base classes |
| 185 | are not automatically called. If __del__ manages to store a reference |
| 186 | to the object somewhere, its destruction is postponed; when the object |
| 187 | is again about to be destroyed its __del__() method will be called |
| 188 | again. |
| 189 | |
| 190 | * Classes may define a method __hash__(self) to allow their instances |
| 191 | to be used as dictionary keys. This must return a 32-bit integer. |
| 192 | |
| 193 | |
| 194 | Minor improvements |
| 195 | ------------------ |
| 196 | |
| 197 | * Function and class objects now know their name (the name given in |
| 198 | the 'def' or 'class' statement that created them). |
| 199 | |
| 200 | * Class instances now know their class name. |
| 201 | |
| 202 | |
| 203 | Additions to built-in operations |
| 204 | -------------------------------- |
| 205 | |
| 206 | * The % operator with a string left argument implements formatting |
| 207 | similar to sprintf() in C. The right argument is either a single |
| 208 | value or a tuple of values. All features of Standard C sprintf() are |
| 209 | supported except %p. |
| 210 | |
| 211 | * Dictionaries now support almost any key type, instead of just |
| 212 | strings. (The key type must be an immutable type or must be a class |
| 213 | instance where the class defines a method __hash__(), in order to |
| 214 | avoid losing track of keys whose value may change.) |
| 215 | |
| 216 | * Built-in methods are now compared properly: when comparing x.meth1 |
| 217 | and y.meth2, if x is equal to y and the methods are defined by the |
| 218 | same function, x.meth1 compares equal to y.meth2. |
| 219 | |
| 220 | |
| 221 | Additions to built-in functions |
| 222 | ------------------------------- |
| 223 | |
| 224 | * str(x) returns a string version of its argument. If the argument is |
| 225 | a string it is returned unchanged, otherwise it returns `x`. |
| 226 | |
| 227 | * repr(x) returns the same as `x`. (Some users found it easier to |
| 228 | have this as a function.) |
| 229 | |
| 230 | * round(x) returns the floating point number x rounded to an whole |
| 231 | number, represented as a floating point number. round(x, n) returns x |
| 232 | rounded to n digits. |
| 233 | |
| 234 | * hasattr(x, name) returns true when x has an attribute with the given |
| 235 | name. |
| 236 | |
| 237 | * hash(x) returns a hash code (32-bit integer) of an arbitrary |
| 238 | immutable object's value. |
| 239 | |
| 240 | * id(x) returns a unique identifier (32-bit integer) of an arbitrary |
| 241 | object. |
| 242 | |
| 243 | * compile() compiles a string to a Python code object. |
| 244 | |
| 245 | * exec() and eval() now support execution of code objects. |
| 246 | |
| 247 | |
| 248 | Changes to the documented part of the library (standard modules) |
| 249 | ---------------------------------------------------------------- |
| 250 | |
| 251 | * os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so |
| 252 | the border case '/foo/..' returns '/' instead of ''. |
| 253 | |
| 254 | * A new function string.find() is added with similar semantics to |
| 255 | string.index(); however when it does not find the given substring it |
| 256 | returns -1 instead of raising string.index_error. |
| 257 | |
| 258 | |
| 259 | Changes to built-in modules |
| 260 | --------------------------- |
| 261 | |
| 262 | * New optional module 'array' implements operations on sequences of |
| 263 | integers or floating point numbers of a particular size. This is |
| 264 | useful to manipulate large numerical arrays or to read and write |
| 265 | binary files consisting of numerical data. |
| 266 | |
| 267 | * Regular expression objects created by module regex now support a new |
| 268 | method named group(), which returns one or more \(...\) groups by number. |
| 269 | The number of groups is increased from 10 to 100. |
| 270 | |
| 271 | * Function compile() in module regex now supports an optional mapping |
| 272 | argument; a variable casefold is added to the module which can be used |
| 273 | as a standard uppercase to lowercase mapping. |
| 274 | |
| 275 | * Module time now supports many routines that are defined in the |
| 276 | Standard C time interface (<time.h>): gmtime(), localtime(), |
| 277 | asctime(), ctime(), mktime(), as well as these variables (taken from |
| 278 | System V): timezone, altzone, daylight and tzname. (The corresponding |
| 279 | functions in the undocumented module calendar have been removed; the |
| 280 | undocumented and unfinished module tzparse is now obsolete and will |
| 281 | disappear in a future release.) |
| 282 | |
| 283 | * Module strop (the fast built-in version of standard module string) |
| 284 | now uses C's definition of whitespace instead of fixing it to space, |
| 285 | tab and newline; in practice this usually means that vertical tab, |
| 286 | form feed and return are now also considered whitespace. It exports |
| 287 | the string of characters that are considered whitespace as well as the |
| 288 | characters that are considered lowercase or uppercase. |
| 289 | |
| 290 | * Module sys now defines the variable builtin_module_names, a list of |
| 291 | names of modules built into the current interpreter (including not |
| 292 | yet imported, but excluding two special modules that always have to be |
| 293 | defined -- sys and builtin). |
| 294 | |
| 295 | * Objects created by module sunaudiodev now also support flush() and |
| 296 | close() methods. |
| 297 | |
| 298 | * Socket objects created by module socket now support an optional |
| 299 | flags argument for their methods sendto() and recvfrom(). |
| 300 | |
| 301 | * Module marshal now supports dumping to and loading from strings, |
| 302 | through the functions dumps() and loads(). |
| 303 | |
| 304 | * Module stdwin now supports some new functionality. You may have to |
| 305 | ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.) |
| 306 | |
| 307 | |
| 308 | Bugs fixed |
| 309 | ---------- |
| 310 | |
| 311 | * Fixed comparison of negative long integers. |
| 312 | |
| 313 | * The tokenizer no longer botches input lines longer than BUFSIZ. |
| 314 | |
| 315 | * Fixed several severe memory leaks in module select. |
| 316 | |
| 317 | * Fixed memory leaks in modules socket and sv. |
| 318 | |
| 319 | * Fixed memory leak in divmod() for long integers. |
| 320 | |
| 321 | * Problems with definition of floatsleep() on Suns fixed. |
| 322 | |
| 323 | * Many portability bugs fixed (and undoubtedly new ones added :-). |
| 324 | |
| 325 | |
| 326 | Changes to the build procedure |
| 327 | ------------------------------ |
| 328 | |
| 329 | * The Makefile supports some new targets: "make default" and "make |
| 330 | all". Both are by normally equivalent to "make python". |
| 331 | |
| 332 | * The Makefile no longer uses $> since it's not supported by all |
| 333 | versions of Make. |
| 334 | |
| 335 | * The header files now all contain #ifdef constructs designed to make |
| 336 | it safe to include the same header file twice, as well as support for |
| 337 | inclusion from C++ programs (automatic extern "C" { ... } added). |
| 338 | |
| 339 | |
| 340 | Freezing Python scripts |
| 341 | ----------------------- |
| 342 | |
| 343 | * There is now some support for "freezing" a Python script as a |
| 344 | stand-alone executable binary file. See the script |
| 345 | demo/scripts/freeze.py. It will require some site-specific tailoring |
| 346 | of the script to get this working, but is quite worthwhile if you write |
| 347 | Python code for other who may not have built and installed Python. |
| 348 | |
| 349 | |
| 350 | MS-DOS |
| 351 | ------ |
| 352 | |
| 353 | * A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks, |
| 354 | Marcel van der Peijl! This requires fewer compatibility hacks in |
| 355 | posixmodule.c. The executable is not yet available but will be soon |
| 356 | (check the mailing list). |
| 357 | |
| 358 | * The default PYTHONPATH has changed. |
| 359 | |
| 360 | |
| 361 | Changes for developers of extension modules |
| 362 | ------------------------------------------- |
| 363 | |
| 364 | * Read src/ChangeLog for full details. |
| 365 | |
| 366 | |
| 367 | SGI specific changes |
| 368 | -------------------- |
| 369 | |
| 370 | * Read src/ChangeLog for full details. |
| 371 | |
| 372 | ================================== |
| 373 | ==> Release 0.9.8 (9 Jan 1993) <== |
| 374 | ================================== |
| 375 | |
| 376 | I claim no completeness here, but I've tried my best to scan the log |
| 377 | files throughout my source tree for interesting bits of news. A more |
| 378 | complete account of the changes is to be found in the various |
| 379 | ChangeLog files. See also "News for release 0.9.7beta" below if you're |
| 380 | still using release 0.9.6, and the file HISTORY if you have an even |
| 381 | older release. |
| 382 | |
| 383 | --Guido |
| 384 | |
| 385 | |
| 386 | Changes to the language proper |
| 387 | ------------------------------ |
| 388 | |
| 389 | There's only one big change: the conformance checking for function |
| 390 | argument lists (of user-defined functions only) is stricter. Earlier, |
| 391 | you could get away with the following: |
| 392 | |
| 393 | (a) define a function of one argument and call it with any |
| 394 | number of arguments; if the actual argument count wasn't |
| 395 | one, the function would receive a tuple containing the |
| 396 | arguments arguments (an empty tuple if there were none). |
| 397 | |
| 398 | (b) define a function of two arguments, and call it with more |
| 399 | than two arguments; if there were more than two arguments, |
| 400 | the second argument would be passed as a tuple containing |
| 401 | the second and further actual arguments. |
| 402 | |
| 403 | (Note that an argument (formal or actual) that is a tuple is counted as |
| 404 | one; these rules don't apply inside such tuples, only at the top level |
| 405 | of the argument list.) |
| 406 | |
| 407 | Case (a) was needed to accommodate variable-length argument lists; |
| 408 | there is now an explicit "varargs" feature (precede the last argument |
| 409 | with a '*'). Case (b) was needed for compatibility with old class |
| 410 | definitions: up to release 0.9.4 a method with more than one argument |
| 411 | had to be declared as "def meth(self, (arg1, arg2, ...)): ...". |
| 412 | Version 0.9.6 provide better ways to handle both casees, bot provided |
| 413 | backward compatibility; version 0.9.8 retracts the compatibility hacks |
| 414 | since they also cause confusing behavior if a function is called with |
| 415 | the wrong number of arguments. |
| 416 | |
| 417 | There's a script that helps converting classes that still rely on (b), |
| 418 | provided their methods' first argument is called "self": |
| 419 | demo/scripts/methfix.py. |
| 420 | |
| 421 | If this change breaks lots of code you have developed locally, try |
| 422 | #defining COMPAT_HACKS in ceval.c. |
| 423 | |
| 424 | (There's a third compatibility hack, which is the reverse of (a): if a |
| 425 | function is defined with two or more arguments, and called with a |
| 426 | single argument that is a tuple with just as many arguments, the items |
| 427 | of this tuple will be used as the arguments. Although this can (and |
| 428 | should!) be done using the built-in function apply() instead, it isn't |
| 429 | withdrawn yet.) |
| 430 | |
| 431 | |
| 432 | One minor change: comparing instance methods works like expected, so |
| 433 | that if x is an instance of a user-defined class and has a method m, |
| 434 | then (x.m==x.m) yields 1. |
| 435 | |
| 436 | |
| 437 | The following was already present in 0.9.7beta, but not explicitly |
| 438 | mentioned in the NEWS file: user-defined classes can now define types |
| 439 | that behave in almost allrespects like numbers. See |
| 440 | demo/classes/Rat.py for a simple example. |
| 441 | |
| 442 | |
| 443 | Changes to the build process |
| 444 | ---------------------------- |
| 445 | |
| 446 | The Configure.py script and the Makefile has been made somewhat more |
| 447 | bullet-proof, after reports of (minor) trouble on certain platforms. |
| 448 | |
| 449 | There is now a script to patch Makefile and config.c to add a new |
| 450 | optional built-in module: Addmodule.sh. Read the script before using! |
| 451 | |
| 452 | Useing Addmodule.sh, all optional modules can now be configured at |
| 453 | compile time using Configure.py, so there are no modules left that |
| 454 | require dynamic loading. |
| 455 | |
| 456 | The Makefile has been fixed to make it easier to use with the VPATH |
| 457 | feature of some Make versions (e.g. SunOS). |
| 458 | |
| 459 | |
| 460 | Changes affecting portability |
| 461 | ----------------------------- |
| 462 | |
| 463 | Several minor portability problems have been solved, e.g. "malloc.h" |
| 464 | has been renamed to "mymalloc.h", "strdup.c" is no longer used, and |
| 465 | the system now tolerates malloc(0) returning 0. |
| 466 | |
| 467 | For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now |
| 468 | distributed with Python. This solves several minor problems, in |
| 469 | particular scripts invoked using #! can now use dynamic loading. |
| 470 | |
| 471 | |
| 472 | Changes to the interpreter interface |
| 473 | ------------------------------------ |
| 474 | |
| 475 | On popular demand, there's finally a "profile" feature for interactive |
| 476 | use of the interpreter. If the environment variable $PYTHONSTARTUP is |
| 477 | set to the name of an existing file, Python statements in this file |
| 478 | are executed when the interpreter is started in interactive mode. |
| 479 | |
| 480 | There is a new clean-up mechanism, complementing try...finally: if you |
| 481 | assign a function object to sys.exitfunc, it will be called when |
| 482 | Python exits or receives a SIGTERM or SIGHUP signal. |
| 483 | |
| 484 | The interpreter is now generally assumed to live in |
| 485 | /usr/local/bin/python (as opposed to /usr/local/python). The script |
| 486 | demo/scripts/fixps.py will update old scripts in place (you can easily |
| 487 | modify it to do other similar changes). |
| 488 | |
| 489 | Most I/O that uses sys.stdin/stdout/stderr will now use any object |
| 490 | assigned to those names as long as the object supports readline() or |
| 491 | write() methods. |
| 492 | |
| 493 | The parser stack has been increased to 500 to accommodate more |
| 494 | complicated expressions (7 levels used to be the practical maximum, |
| 495 | it's now about 38). |
| 496 | |
| 497 | The limit on the size of the *run-time* stack has completely been |
| 498 | removed -- this means that tuple or list displays can contain any |
| 499 | number of elements (formerly more than 50 would crash the |
| 500 | interpreter). |
| 501 | |
| 502 | |
| 503 | Changes to existing built-in functions and methods |
| 504 | -------------------------------------------------- |
| 505 | |
| 506 | The built-in functions int(), long(), float(), oct() and hex() now |
| 507 | also apply to class instalces that define corresponding methods |
| 508 | (__int__ etc.). |
| 509 | |
| 510 | |
| 511 | New built-in functions |
| 512 | ---------------------- |
| 513 | |
| 514 | The new functions str() and repr() convert any object to a string. |
| 515 | The function repr(x) is in all respects equivalent to `x` -- some |
| 516 | people prefer a function for this. The function str(x) does the same |
| 517 | except if x is already a string -- then it returns x unchanged |
| 518 | (repr(x) adds quotes and escapes "funny" characters as octal escapes). |
| 519 | |
| 520 | The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y. |
| 521 | |
| 522 | |
| 523 | Changes to general built-in modules |
| 524 | ----------------------------------- |
| 525 | |
| 526 | The time module's functions are more general: time() returns a |
| 527 | floating point number and sleep() accepts one. Their accuracies |
| 528 | depends on the precision of the system clock. Millisleep is no longer |
| 529 | needed (although it still exists for now), but millitimer is still |
| 530 | needed since on some systems wall clock time is only available with |
| 531 | seconds precision, while a source of more precise time exists that |
| 532 | isn't synchronized with the wall clock. (On UNIX systems that support |
| 533 | the BSD gettimeofday() function, time.time() is as time.millitimer().) |
| 534 | |
| 535 | The string representation of a file object now includes an address: |
| 536 | '<file 'filename', mode 'r' at #######>' where ###### is a hex number |
| 537 | (the object's address) to make it unique. |
| 538 | |
| 539 | New functions added to posix: nice(), setpgrp(), and if your system |
| 540 | supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp(). |
| 541 | |
| 542 | Improvements to the socket module: socket objects have new methods |
| 543 | getpeername() and getsockname(), and the {get,set}sockopt methods can |
| 544 | now get/set any kind of option using strings built with the new struct |
| 545 | module. And there's a new function fromfd() which creates a socket |
| 546 | object given a file descriptor (useful for servers started by inetd, |
| 547 | which have a socket connected to stdin and stdout). |
| 548 | |
| 549 | |
| 550 | Changes to SGI-specific built-in modules |
| 551 | ---------------------------------------- |
| 552 | |
| 553 | The FORMS library interface (fl) now requires FORMS 2.1a. Some new |
| 554 | functions have been added and some bugs have been fixed. |
| 555 | |
| 556 | Additions to al (audio library interface): added getname(), |
| 557 | getdefault() and getminmax(). |
| 558 | |
| 559 | The gl modules doesn't call "foreground()" when initialized (this |
| 560 | caused some problems) like it dit in 0.9.7beta (but not before). |
| 561 | There's a new gl function 'gversion() which returns a version string. |
| 562 | |
| 563 | The interface to sv (Indigo video interface) has totally changed. |
| 564 | (Sorry, still no documentation, but see the examples in |
| 565 | demo/sgi/{sv,video}.) |
| 566 | |
| 567 | |
| 568 | Changes to standard library modules |
| 569 | ----------------------------------- |
| 570 | |
| 571 | Most functions in module string are now much faster: they're actually |
| 572 | implemented in C. The module containing the C versions is called |
| 573 | "strop" but you should still import "string" since strop doesn't |
| 574 | provide all the interfaces defined in string (and strop may be renamed |
| 575 | to string when it is complete in a future release). |
| 576 | |
| 577 | string.index() now accepts an optional third argument giving an index |
| 578 | where to start searching in the first argument, so you can find second |
| 579 | and further occurrences (this is similar to the regular expression |
| 580 | functions in regex). |
| 581 | |
| 582 | The definition of what string.splitfields(anything, '') should return |
| 583 | is changed for the last time: it returns a singleton list containing |
| 584 | its whole first argument unchanged. This is compatible with |
| 585 | regsub.split() which also ignores empty delimiter matches. |
| 586 | |
| 587 | posixpath, macpath: added dirname() and normpath() (and basename() to |
| 588 | macpath). |
| 589 | |
| 590 | The mainloop module (for use with stdwin) can now demultiplex input |
| 591 | from other sources, as long as they can be polled with select(). |
| 592 | |
| 593 | |
| 594 | New built-in modules |
| 595 | -------------------- |
| 596 | |
| 597 | Module struct defines functions to pack/unpack values to/from strings |
| 598 | representing binary values in native byte order. |
| 599 | |
| 600 | Module strop implements C versions of many functions from string (see |
| 601 | above). |
| 602 | |
| 603 | Optional module fcntl defines interfaces to fcntl() and ioctl() -- |
| 604 | UNIX only. (Not yet properly documented -- see however src/fcntl.doc.) |
| 605 | |
| 606 | Optional module mpz defines an interface to an altaernative long |
| 607 | integer implementation, the GNU MPZ library. |
| 608 | |
| 609 | Optional module md5 uses the GNU MPZ library to calculate MD5 |
| 610 | signatures of strings. |
| 611 | |
| 612 | There are also optional new modules specific to SGI machines: imageop |
| 613 | defines some simple operations to images represented as strings; sv |
| 614 | interfaces to the Indigo video board; cl interfaces to the (yet |
| 615 | unreleased) compression library. |
| 616 | |
| 617 | |
| 618 | New standard library modules |
| 619 | ---------------------------- |
| 620 | |
| 621 | (Unfortunately the following modules are not all documented; read the |
| 622 | sources to find out more about them!) |
| 623 | |
| 624 | autotest: run testall without showing any output unless it differs |
| 625 | from the expected output |
| 626 | |
| 627 | bisect: use bisection to insert or find an item in a sorted list |
| 628 | |
| 629 | colorsys: defines conversions between various color systems (e.g. RGB |
| 630 | <-> YUV) |
| 631 | |
| 632 | nntplib: a client interface to NNTP servers |
| 633 | |
| 634 | pipes: utility to construct pipeline from templates, e.g. for |
| 635 | conversion from one file format to another using several utilities. |
| 636 | |
| 637 | regsub: contains three functions that are more or less compatible with |
| 638 | awk functions of the same name: sub() and gsub() do string |
| 639 | substitution, split() splits a string using a regular expression to |
| 640 | define how separators are define. |
| 641 | |
| 642 | test_types: test operations on the built-in types of Python |
| 643 | |
| 644 | toaiff: convert various audio file formats to AIFF format |
| 645 | |
| 646 | tzparse: parse the TZ environment parameter (this may be less general |
| 647 | than it could be, let me know if you fix it). |
| 648 | |
| 649 | (Note that the obsolete module "path" no longer exists.) |
| 650 | |
| 651 | |
| 652 | New SGI-specific library modules |
| 653 | -------------------------------- |
| 654 | |
| 655 | CL: constants for use with the built-in compression library interface (cl) |
| 656 | |
| 657 | Queue: a multi-producer, multi-consumer queue class implemented for |
| 658 | use with the built-in thread module |
| 659 | |
| 660 | SOCKET: constants for use with built-in module socket, e.g. to set/get |
| 661 | socket options. This is SGI-specific because the constants to be |
| 662 | passed are system-dependent. You can generate a version for your own |
| 663 | system by running the script demo/scripts/h2py.py with |
| 664 | /usr/include/sys/socket.h as input. |
| 665 | |
| 666 | cddb: interface to the database used the the CD player |
| 667 | |
| 668 | torgb: convert various image file types to rgb format (requires pbmplus) |
| 669 | |
| 670 | |
| 671 | New demos |
| 672 | --------- |
| 673 | |
| 674 | There's an experimental interface to define Sun RPC clients and |
| 675 | servers in demo/rpc. |
| 676 | |
| 677 | There's a collection of interfaces to WWW, WAIS and Gopher (both |
| 678 | Python classes and program providing a user interface) in demo/www. |
| 679 | This includes a program texi2html.py which converts texinfo files to |
| 680 | HTML files (the format used hy WWW). |
| 681 | |
| 682 | The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse. |
| 683 | |
| 684 | For SGI systems, there's a whole collection of programs and classes |
| 685 | that make use of the Indigo video board in demo/sgi/{sv,video}. This |
| 686 | represents a significant amount of work that we're giving away! |
| 687 | |
| 688 | There are demos "rsa" and "md5test" that exercise the mpz and md5 |
| 689 | modules, respectively. The rsa demo is a complete implementation of |
| 690 | the RSA public-key cryptosystem! |
| 691 | |
| 692 | A bunch of games and examples submitted by Stoffel Erasmus have been |
| 693 | included in demo/stoffel. |
| 694 | |
| 695 | There are miscellaneous new files in some existing demo |
| 696 | subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py, |
| 697 | sgi/al/cmpaf.py, sockets/{mcast,gopher}.py. |
| 698 | |
| 699 | There are also many minor changes to existing files, but I'm too lazy |
| 700 | to run a diff and note the differences -- you can do this yourself if |
| 701 | you save the old distribution's demos. One highlight: the |
| 702 | stdwin/python.py demo is much improved! |
| 703 | |
| 704 | |
| 705 | Changes to the documentation |
| 706 | ---------------------------- |
| 707 | |
| 708 | The LaTeX source for the library uses different macros to enable it to |
| 709 | be converted to texinfo, and from there to INFO or HTML format so it |
| 710 | can be browsed as a hypertext. The net result is that you can now |
| 711 | read the Python library documentation in Emacs info mode! |
| 712 | |
| 713 | |
| 714 | Changes to the source code that affect C extension writers |
| 715 | ---------------------------------------------------------- |
| 716 | |
| 717 | The function strdup() no longer exists (it was used only in one places |
| 718 | and is somewhat of a a portability problem sice some systems have the |
| 719 | same function in their C library. |
| 720 | |
| 721 | The functions NEW() and RENEW() allocate one spare byte to guard |
| 722 | against a NULL return from malloc(0) being taken for an error, but |
| 723 | this should not be relied upon. |
| 724 | |
| 725 | |
| 726 | ========================= |
| 727 | ==> Release 0.9.7beta <== |
| 728 | ========================= |
| 729 | |
| 730 | |
| 731 | Changes to the language proper |
| 732 | ------------------------------ |
| 733 | |
| 734 | User-defined classes can now implement operations invoked through |
| 735 | special syntax, such as x[i] or `x` by defining methods named |
| 736 | __getitem__(self, i) or __repr__(self), etc. |
| 737 | |
| 738 | |
| 739 | Changes to the build process |
| 740 | ---------------------------- |
| 741 | |
| 742 | Instead of extensive manual editing of the Makefile to select |
| 743 | compile-time options, you can now run a Configure.py script. |
| 744 | The Makefile as distributed builds a minimal interpreter sufficient to |
| 745 | run Configure.py. See also misc/BUILD |
| 746 | |
| 747 | The Makefile now includes more "utility" targets, e.g. install and |
| 748 | tags/TAGS |
| 749 | |
| 750 | Using the provided strtod.c and strtol.c are now separate options, as |
| 751 | on the Sun the provided strtod.c dumps core :-( |
| 752 | |
| 753 | The regex module is now an option chosen by the Makefile, since some |
| 754 | (old) C compilers choke on regexpr.c |
| 755 | |
| 756 | |
| 757 | Changes affecting portability |
| 758 | ----------------------------- |
| 759 | |
| 760 | You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin |
| 761 | interface |
| 762 | |
| 763 | Dynamic loading is now supported for Sun (and other non-COFF systems) |
| 764 | throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's |
| 765 | DL is out, 1.4) |
| 766 | |
| 767 | The system-dependent code for the use of the select() system call is |
| 768 | moved to one file: myselect.h |
| 769 | |
| 770 | Thanks to Jaap Vermeulen, the code should now port cleanly to the |
| 771 | SEQUENT |
| 772 | |
| 773 | |
| 774 | Changes to the interpreter interface |
| 775 | ------------------------------------ |
| 776 | |
| 777 | The interpretation of $PYTHONPATH in the environment is different: it |
| 778 | is inserted in front of the default path instead of overriding it |
| 779 | |
| 780 | |
| 781 | Changes to existing built-in functions and methods |
| 782 | -------------------------------------------------- |
| 783 | |
| 784 | List objects now support an optional argument to their sort() method, |
| 785 | which is a comparison function similar to qsort(3) in C |
| 786 | |
| 787 | File objects now have a method fileno(), used by the new select module |
| 788 | (see below) |
| 789 | |
| 790 | |
| 791 | New built-in function |
| 792 | --------------------- |
| 793 | |
| 794 | coerce(x, y): take two numbers and return a tuple containing them |
| 795 | both converted to a common type |
| 796 | |
| 797 | |
| 798 | Changes to built-in modules |
| 799 | --------------------------- |
| 800 | |
| 801 | sys: fixed core dumps in settrace() and setprofile() |
| 802 | |
| 803 | socket: added socket methods setsockopt() and getsockopt(); and |
| 804 | fileno(), used by the new select module (see below) |
| 805 | |
| 806 | stdwin: added fileno() == connectionnumber(), in support of new module |
| 807 | select (see below) |
| 808 | |
| 809 | posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function. |
| 810 | |
| 811 | gl: added qgetfd() |
| 812 | |
| 813 | fl: added several new functions, fixed several obscure bugs, adapted |
| 814 | to FORMS 2.1 |
| 815 | |
| 816 | |
| 817 | Changes to standard modules |
| 818 | --------------------------- |
| 819 | |
| 820 | posixpath: changed implementation of ismount() |
| 821 | |
| 822 | string: atoi() no longer mistakes leading zero for octal number |
| 823 | |
| 824 | ... |
| 825 | |
| 826 | |
| 827 | New built-in modules |
| 828 | -------------------- |
| 829 | |
| 830 | Modules marked "dynamic only" are not configured at compile time but |
| 831 | can be loaded dynamically. You need to turn on the DL or DLD option in |
| 832 | the Makefile for support dynamic loading of modules (this requires |
| 833 | external code). |
| 834 | |
| 835 | select: interfaces to the BSD select() system call |
| 836 | |
| 837 | dbm: interfaces to the (new) dbm library (dynamic only) |
| 838 | |
| 839 | nis: interfaces to some NIS functions (aka yellow pages) |
| 840 | |
| 841 | thread: limited form of multiple threads (sgi only) |
| 842 | |
| 843 | audioop: operations useful for audio programs, e.g. u-LAW and ADPCM |
| 844 | coding (dynamic only) |
| 845 | |
| 846 | cd: interface to Indigo SCSI CDROM player audio library (sgi only) |
| 847 | |
| 848 | jpeg: read files in JPEG format (dynamic only, sgi only; needs |
| 849 | external code) |
| 850 | |
| 851 | imgfile: read SGI image files (dynamic only, sgi only) |
| 852 | |
| 853 | sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only) |
| 854 | |
| 855 | sv: interface to Indigo video library (sgi only) |
| 856 | |
| 857 | pc: a minimal set of MS-DOS interfaces (MS-DOS only) |
| 858 | |
| 859 | rotor: encryption, by Lance Ellinghouse (dynamic only) |
| 860 | |
| 861 | |
| 862 | New standard modules |
| 863 | -------------------- |
| 864 | |
| 865 | Not all these modules are documented. Read the source: |
| 866 | lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains |
| 867 | additional documentation. |
| 868 | |
| 869 | imghdr: recognizes image file headers |
| 870 | |
| 871 | sndhdr: recognizes sound file headers |
| 872 | |
| 873 | profile: print run-time statistics of Python code |
| 874 | |
| 875 | readcd, cdplayer: companion modules for built-in module cd (sgi only) |
| 876 | |
| 877 | emacs: interface to Emacs using py-connect.el (see below). |
| 878 | |
| 879 | SOCKET: symbolic constant definitions for socket options |
| 880 | |
| 881 | SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only) |
| 882 | |
| 883 | SV: symbolic constat definitions for sv (sgi only) |
| 884 | |
| 885 | CD: symbolic constat definitions for cd (sgi only) |
| 886 | |
| 887 | |
| 888 | New demos |
| 889 | --------- |
| 890 | |
| 891 | scripts/pp.py: execute Python as a filter with a Perl-like command |
| 892 | line interface |
| 893 | |
| 894 | classes/: examples using the new class features |
| 895 | |
| 896 | threads/: examples using the new thread module |
| 897 | |
| 898 | sgi/cd/: examples using the new cd module |
| 899 | |
| 900 | |
| 901 | Changes to the documentation |
| 902 | ---------------------------- |
| 903 | |
| 904 | The last-minute syntax changes of release 0.9.6 are now reflected |
| 905 | everywhere in the manuals |
| 906 | |
| 907 | The reference manual has a new section (3.2) on implementing new kinds |
| 908 | of numbers, sequences or mappings with user classes |
| 909 | |
| 910 | Classes are now treated extensively in the tutorial (chapter 9) |
| 911 | |
| 912 | Slightly restructured the system-dependent chapters of the library |
| 913 | manual |
| 914 | |
| 915 | The file misc/EXTENDING incorporates documentation for mkvalue() and |
| 916 | a new section on error handling |
| 917 | |
| 918 | The files misc/CLASSES and misc/ERRORS are no longer necessary |
| 919 | |
| 920 | The doc/Makefile now creates PostScript files automatically |
| 921 | |
| 922 | |
| 923 | Miscellaneous changes |
| 924 | --------------------- |
| 925 | |
| 926 | Incorporated Tim Peters' changes to python-mode.el, it's now version |
| 927 | 1.06 |
| 928 | |
| 929 | A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python |
| 930 | program running in an Emacs buffer execute Emacs lisp code. The |
| 931 | necessary Python code is in lib/emacs.py. The Emacs code is |
| 932 | misc/py-connect.el (it needs some external Emacs lisp code) |
| 933 | |
| 934 | |
| 935 | Changes to the source code that affect C extension writers |
| 936 | ---------------------------------------------------------- |
| 937 | |
| 938 | New service function mkvalue() to construct a Python object from C |
| 939 | values according to a "format" string a la getargs() |
| 940 | |
| 941 | Most functions from pythonmain.c moved to new pythonrun.c which is |
| 942 | in libpython.a. This should make embedded versions of Python easier |
| 943 | |
| 944 | ceval.h is split in eval.h (which needs compile.h and only declares |
| 945 | eval_code) and ceval.h (which doesn't need compile.hand declares the |
| 946 | rest) |
| 947 | |
| 948 | ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to |
| 949 | improve the parallellism of multi-threaded programs by letting other |
| 950 | Python code run when a blocking system call or something similar is |
| 951 | made) |
| 952 | |
| 953 | In structmember.[ch], new member types BYTE, CHAR and unsigned |
| 954 | variants have been added |
| 955 | |
| 956 | New file xxmodule.c is a template for new extension modules. |
| 957 | |
| 958 | ================================== |
| 959 | ==> RELEASE 0.9.6 (6 Apr 1992) <== |
| 960 | ================================== |
| 961 | |
| 962 | Misc news in 0.9.6: |
| 963 | - Restructured the misc subdirectory |
| 964 | - Reference manual completed, library manual much extended (with indexes!) |
| 965 | - the GNU Readline library is now distributed standard with Python |
| 966 | - the script "../demo/scripts/classfix.py" fixes Python modules using old |
| 967 | class syntax |
| 968 | - Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!) |
| 969 | - Because of the GNU copyleft business I am not using the GNU regular |
| 970 | expression implementation but a free re-implementation by Tatu Ylonen |
| 971 | that recently appeared in comp.sources.misc (Bravo, Tatu!) |
| 972 | |
| 973 | New features in 0.9.6: |
| 974 | - stricter try stmt syntax: cannot mix except and finally clauses on 1 try |
| 975 | - New module 'os' supplants modules 'mac' and 'posix' for most cases; |
| 976 | module 'path' is replaced by 'os.path' |
| 977 | - os.path.split() return value differs from that of old path.split() |
| 978 | - sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception |
| 979 | currently being handled |
| 980 | - sys.last_type, sys.last_value, sys.last_traceback remember last unhandled |
| 981 | exception |
| 982 | - New function string.expandtabs() expands tabs in a string |
| 983 | - Added times() interface to posix (user & sys time of process & children) |
| 984 | - Added uname() interface to posix (returns OS type, hostname, etc.) |
| 985 | - New built-in function execfile() is like exec() but from a file |
| 986 | - Functions exec() and eval() are less picky about whitespace/newlines |
| 987 | - New built-in functions getattr() and setattr() access arbitrary attributes |
| 988 | - More generic argument handling in built-in functions (see "./EXTENDING") |
| 989 | - Dynamic loading of modules written in C or C++ (see "./DYNLOAD") |
| 990 | - Division and modulo for long and plain integers with negative operands |
| 991 | have changed; a/b is now floor(float(a)/float(b)) and a%b is defined |
| 992 | as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as |
| 993 | (a/b, a%b) for integers. For floats, % is also changed, but of course |
| 994 | / is unchanged, and divmod(x,y) does not yield (x/y, x%y)... |
| 995 | - A function with explicit variable-length argument list can be declared |
| 996 | like this: def f(*args): ...; or even like this: def f(a, b, *rest): ... |
| 997 | - Code tracing and profiling features have been added, and two source |
| 998 | code debuggers are provided in the library (pdb.py, tty-oriented, |
| 999 | and wdb, window-oriented); you can now step through Python programs! |
| 1000 | See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc" |
| 1001 | - '==' is now the only equality operator; "../demo/scripts/eqfix.py" is |
| 1002 | a script that fixes old Python modules |
| 1003 | - Plain integer right shift now uses sign extension |
| 1004 | - Long integer shift/mask operations now simulate 2's complement |
| 1005 | to give more useful results for negative operands |
| 1006 | - Changed/added range checks for long/plain integer shifts |
| 1007 | - Options found after "-c command" are now passed to the command in sys.argv |
| 1008 | (note subtle incompatiblity with "python -c command -- -options"!) |
| 1009 | - Module stdwin is better protected against touching objects after they've |
| 1010 | been closed; menus can now also be closed explicitly |
| 1011 | - Stdwin now uses its own exception (stdwin.error) |
| 1012 | |
| 1013 | New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992): |
| 1014 | - dictionary objects can now be compared properly; e.g., {}=={} is true |
| 1015 | - new exception SystemExit causes termination if not caught; |
| 1016 | it is raised by sys.exit() so that 'finally' clauses can clean up, |
| 1017 | and it may even be caught. It does work interactively! |
| 1018 | - new module "regex" implements GNU Emacs style regular expressions; |
| 1019 | module "regexp" is rewritten in Python for backward compatibility |
| 1020 | - formal parameter lists may contain trailing commas |
| 1021 | |
| 1022 | Bugs fixed in 0.9.6: |
| 1023 | - assigning to or deleting a list item with a negative index dumped core |
| 1024 | - divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L) |
| 1025 | |
| 1026 | Bugs fixed in 0.9.5: |
| 1027 | - masking operations involving negative long integers gave wrong results |
| 1028 | |
| 1029 | |
| 1030 | =================================== |
| 1031 | ==> RELEASE 0.9.4 (24 Dec 1991) <== |
| 1032 | =================================== |
| 1033 | |
| 1034 | - new function argument handling (see below) |
| 1035 | - built-in apply(func, args) means func(args[0], args[1], ...) |
| 1036 | - new, more refined exceptions |
| 1037 | - new exception string values (NameError = 'NameError' etc.) |
| 1038 | - better checking for math exceptions |
| 1039 | - for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i] |
| 1040 | - fixed list assignment bug: "a[1:1] = a" now works correctly |
| 1041 | - new class syntax, without extraneous parentheses |
| 1042 | - new 'global' statement to assign global variables from within a function |
| 1043 | |
| 1044 | |
| 1045 | New class syntax |
| 1046 | ---------------- |
| 1047 | |
| 1048 | You can now declare a base class as follows: |
| 1049 | |
| 1050 | class B: # Was: class B(): |
| 1051 | def some_method(self): ... |
| 1052 | ... |
| 1053 | |
| 1054 | and a derived class thusly: |
| 1055 | |
| 1056 | class D(B): # Was: class D() = B(): |
| 1057 | def another_method(self, arg): ... |
| 1058 | |
| 1059 | Multiple inheritance looks like this: |
| 1060 | |
| 1061 | class M(B, D): # Was: class M() = B(), D(): |
| 1062 | def this_or_that_method(self, arg): ... |
| 1063 | |
| 1064 | The old syntax is still accepted by Python 0.9.4, but will disappear |
| 1065 | in Python 1.0 (to be posted to comp.sources). |
| 1066 | |
| 1067 | |
| 1068 | New 'global' statement |
| 1069 | ---------------------- |
| 1070 | |
| 1071 | Every now and then you have a global variable in a module that you |
| 1072 | want to change from within a function in that module -- say, a count |
| 1073 | of calls to a function, or an option flag, etc. Until now this was |
| 1074 | not directly possible. While several kludges are known that |
| 1075 | circumvent the problem, and often the need for a global variable can |
| 1076 | be avoided by rewriting the module as a class, this does not always |
| 1077 | lead to clearer code. |
| 1078 | |
| 1079 | The 'global' statement solves this dilemma. Its occurrence in a |
| 1080 | function body means that, for the duration of that function, the |
| 1081 | names listed there refer to global variables. For instance: |
| 1082 | |
| 1083 | total = 0.0 |
| 1084 | count = 0 |
| 1085 | |
| 1086 | def add_to_total(amount): |
| 1087 | global total, count |
| 1088 | total = total + amount |
| 1089 | count = count + 1 |
| 1090 | |
| 1091 | 'global' must be repeated in each function where it is needed. The |
| 1092 | names listed in a 'global' statement must not be used in the function |
| 1093 | before the statement is reached. |
| 1094 | |
| 1095 | Remember that you don't need to use 'global' if you only want to *use* |
| 1096 | a global variable in a function; nor do you need ot for assignments to |
| 1097 | parts of global variables (e.g., list or dictionary items or |
| 1098 | attributes of class instances). This has not changed; in fact |
| 1099 | assignment to part of a global variable was the standard workaround. |
| 1100 | |
| 1101 | |
| 1102 | New exceptions |
| 1103 | -------------- |
| 1104 | |
| 1105 | Several new exceptions have been defined, to distinguish more clearly |
| 1106 | between different types of errors. |
| 1107 | |
| 1108 | name meaning was |
| 1109 | |
| 1110 | AttributeError reference to non-existing attribute NameError |
| 1111 | IOError unexpected I/O error RuntimeError |
| 1112 | ImportError import of non-existing module or name NameError |
| 1113 | IndexError invalid string, tuple or list index RuntimeError |
| 1114 | KeyError key not in dictionary RuntimeError |
| 1115 | OverflowError numeric overflow RuntimeError |
| 1116 | SyntaxError invalid syntax RuntimeError |
| 1117 | ValueError invalid argument value RuntimeError |
| 1118 | ZeroDivisionError division by zero RuntimeError |
| 1119 | |
| 1120 | The string value of each exception is now its name -- this makes it |
| 1121 | easier to experimentally find out which operations raise which |
| 1122 | exceptions; e.g.: |
| 1123 | |
| 1124 | >>> KeyboardInterrupt |
| 1125 | 'KeyboardInterrupt' |
| 1126 | >>> |
| 1127 | |
| 1128 | |
| 1129 | New argument passing semantics |
| 1130 | ------------------------------ |
| 1131 | |
| 1132 | Off-line discussions with Steve Majewski and Daniel LaLiberte have |
| 1133 | convinced me that Python's parameter mechanism could be changed in a |
| 1134 | way that made both of them happy (I hope), kept me happy, fixed a |
| 1135 | number of outstanding problems, and, given some backward compatibility |
| 1136 | provisions, would only break a very small amount of existing code -- |
| 1137 | probably all mine anyway. In fact I suspect that most Python users |
| 1138 | will hardly notice the difference. And yet it has cost me at least |
| 1139 | one sleepless night to decide to make the change... |
| 1140 | |
| 1141 | Philosophically, the change is quite radical (to me, anyway): a |
| 1142 | function is no longer called with either zero or one argument, which |
| 1143 | is a tuple if there appear to be more arguments. Every function now |
| 1144 | has an argument list containing 0, 1 or more arguments. This list is |
| 1145 | always implemented as a tuple, and it is a (run-time) error if a |
| 1146 | function is called with a different number of arguments than expected. |
| 1147 | |
| 1148 | What's the difference? you may ask. The answer is, very little unless |
| 1149 | you want to write variadic functions -- functions that may be called |
| 1150 | with a variable number of arguments. Formerly, you could write a |
| 1151 | function that accepted one or more arguments with little trouble, but |
| 1152 | writing a function that could be called with either 0 or 1 argument |
| 1153 | (or more) was next to impossible. This is now a piece of cake: you |
| 1154 | can simply declare an argument that receives the entire argument |
| 1155 | tuple, and check its length -- it will be of size 0 if there are no |
| 1156 | arguments. |
| 1157 | |
| 1158 | Another anomaly of the old system was the way multi-argument methods |
| 1159 | (in classes) had to be declared, e.g.: |
| 1160 | |
| 1161 | class Point(): |
| 1162 | def init(self, (x, y, color)): ... |
| 1163 | def setcolor(self, color): ... |
| 1164 | dev moveto(self, (x, y)): ... |
| 1165 | def draw(self): ... |
| 1166 | |
| 1167 | Using the new scheme there is no need to enclose the method arguments |
| 1168 | in an extra set of parentheses, so the above class could become: |
| 1169 | |
| 1170 | class Point: |
| 1171 | def init(self, x, y, color): ... |
| 1172 | def setcolor(self, color): ... |
| 1173 | dev moveto(self, x, y): ... |
| 1174 | def draw(self): ... |
| 1175 | |
| 1176 | That is, the equivalence rule between methods and functions has |
| 1177 | changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y) |
| 1178 | while formerly it was equivalent to Point.moveto(p,(x,y)). |
| 1179 | |
| 1180 | A special backward compatibility rule makes that the old version also |
| 1181 | still works: whenever a function with exactly two arguments (at the top |
| 1182 | level) is called with more than two arguments, the second and further |
| 1183 | arguments are packed into a tuple and passed as the second argument. |
| 1184 | This rule is invoked independently of whether the function is actually a |
| 1185 | method, so there is a slight chance that some erroneous calls of |
| 1186 | functions expecting two arguments with more than that number of |
| 1187 | arguments go undetected at first -- when the function tries to use the |
| 1188 | second argument it may find it is a tuple instead of what was expected. |
| 1189 | Note that this rule will be removed from future versions of the |
| 1190 | language; it is a backward compatibility provision *only*. |
| 1191 | |
| 1192 | Two other rules and a new built-in function handle conversion between |
| 1193 | tuples and argument lists: |
| 1194 | |
| 1195 | Rule (a): when a function with more than one argument is called with a |
| 1196 | single argument that is a tuple of the right size, the tuple's items |
| 1197 | are used as arguments. |
| 1198 | |
| 1199 | Rule (b): when a function with exactly one argument receives no |
| 1200 | arguments or more than one, that one argument will receive a tuple |
| 1201 | containing the arguments (the tuple will be empty if there were no |
| 1202 | arguments). |
| 1203 | |
| 1204 | |
| 1205 | A new built-in function, apply(), was added to support functions that |
| 1206 | need to call other functions with a constructed argument list. The call |
| 1207 | |
| 1208 | apply(function, tuple) |
| 1209 | |
| 1210 | is equivalent to |
| 1211 | |
| 1212 | function(tuple[0], tuple[1], ..., tuple[len(tuple)-1]) |
| 1213 | |
| 1214 | |
| 1215 | While no new argument syntax was added in this phase, it would now be |
| 1216 | quite sensible to add explicit syntax to Python for default argument |
| 1217 | values (as in C++ or Modula-3), or a "rest" argument to receive the |
| 1218 | remaining arguments of a variable-length argument list. |
| 1219 | |
| 1220 | |
| 1221 | ======================================================== |
| 1222 | ==> Release 0.9.3 (never made available outside CWI) <== |
| 1223 | ======================================================== |
| 1224 | |
| 1225 | - string sys.version shows current version (also printed on interactive entry) |
| 1226 | - more detailed exceptions, e.g., IOError, ZeroDivisionError, etc. |
| 1227 | - 'global' statement to declare module-global variables assigned in functions. |
| 1228 | - new class declaration syntax: class C(Base1, Base2, ...): suite |
| 1229 | (the old syntax is still accepted -- be sure to convert your classes now!) |
| 1230 | - C shifting and masking operators: << >> ~ & ^ | (for ints and longs). |
| 1231 | - C comparison operators: == != (the old = and <> remain valid). |
| 1232 | - floating point numbers may now start with a period (e.g., .14). |
| 1233 | - definition of integer division tightened (always truncates towards zero). |
| 1234 | - new builtins hex(x), oct(x) return hex/octal string from (long) integer. |
| 1235 | - new list method l.count(x) returns the number of occurrences of x in l. |
| 1236 | - new SGI module: al (Indigo and 4D/35 audio library). |
| 1237 | - the FORMS interface (modules fl and FL) now uses FORMS 2.0 |
| 1238 | - module gl: added lrect{read,write}, rectzoom and pixmode; |
| 1239 | added (non-GL) functions (un)packrect. |
| 1240 | - new socket method: s.allowbroadcast(flag). |
| 1241 | - many objects support __dict__, __methods__ or __members__. |
| 1242 | - dir() lists anything that has __dict__. |
| 1243 | - class attributes are no longer read-only. |
| 1244 | - classes support __bases__, instances support __class__ (and __dict__). |
| 1245 | - divmod() now also works for floats. |
| 1246 | - fixed obscure bug in eval('1 '). |
| 1247 | |
| 1248 | |
| 1249 | =================================== |
| 1250 | ==> Release 0.9.2 (Autumn 1991) <== |
| 1251 | =================================== |
| 1252 | |
| 1253 | Highlights |
| 1254 | ---------- |
| 1255 | |
| 1256 | - tutorial now (almost) complete; library reference reorganized |
| 1257 | - new syntax: continue statement; semicolons; dictionary constructors; |
| 1258 | restrictions on blank lines in source files removed |
| 1259 | - dramatically improved module load time through precompiled modules |
| 1260 | - arbitrary precision integers: compute 2 to the power 1000 and more... |
| 1261 | - arithmetic operators now accept mixed type operands, e.g., 3.14/4 |
| 1262 | - more operations on list: remove, index, reverse; repetition |
| 1263 | - improved/new file operations: readlines, seek, tell, flush, ... |
| 1264 | - process management added to the posix module: fork/exec/wait/kill etc. |
| 1265 | - BSD socket operations (with example servers and clients!) |
| 1266 | - many new STDWIN features (color, fonts, polygons, ...) |
| 1267 | - new SGI modules: font manager and FORMS library interface |
| 1268 | |
| 1269 | |
| 1270 | Extended list of changes in 0.9.2 |
| 1271 | --------------------------------- |
| 1272 | |
| 1273 | Here is a summary of the most important user-visible changes in 0.9.2, |
| 1274 | in somewhat arbitrary order. Changes in later versions are listed in |
| 1275 | the "highlights" section above. |
| 1276 | |
| 1277 | |
| 1278 | 1. Changes to the interpreter proper |
| 1279 | |
| 1280 | - Simple statements can now be separated by semicolons. |
| 1281 | If you write "if t: s1; s2", both s1 and s2 are executed |
| 1282 | conditionally. |
| 1283 | - The 'continue' statement was added, with semantics as in C. |
| 1284 | - Dictionary displays are now allowed on input: {key: value, ...}. |
| 1285 | - Blank lines and lines bearing only a comment no longer need to |
| 1286 | be indented properly. (A completely empty line still ends a multi- |
| 1287 | line statement interactively.) |
| 1288 | - Mixed arithmetic is supported, 1 compares equal to 1.0, etc. |
| 1289 | - Option "-c command" to execute statements from the command line |
| 1290 | - Compiled versions of modules are cached in ".pyc" files, giving a |
| 1291 | dramatic improvement of start-up time |
| 1292 | - Other, smaller speed improvements, e.g., extracting characters from |
| 1293 | strings, looking up single-character keys, and looking up global |
| 1294 | variables |
| 1295 | - Interrupting a print operation raises KeyboardInterrupt instead of |
| 1296 | only cancelling the print operation |
| 1297 | - Fixed various portability problems (it now passes gcc with only |
| 1298 | warnings -- more Standard C compatibility will be provided in later |
| 1299 | versions) |
| 1300 | - Source is prepared for porting to MS-DOS |
| 1301 | - Numeric constants are now checked for overflow (this requires |
| 1302 | standard-conforming strtol() and strtod() functions; a correct |
| 1303 | strtol() implementation is provided, but the strtod() provided |
| 1304 | relies on atof() for everything, including error checking |
| 1305 | |
| 1306 | |
| 1307 | 2. Changes to the built-in types, functions and modules |
| 1308 | |
| 1309 | - New module socket: interface to BSD socket primitives |
| 1310 | - New modules pwd and grp: access the UNIX password and group databases |
| 1311 | - (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager |
| 1312 | - (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library |
| 1313 | - New numeric type: long integer, for unlimited precision |
| 1314 | - integer constants suffixed with 'L' or 'l' are long integers |
| 1315 | - new built-in function long(x) converts int or float to long |
| 1316 | - int() and float() now also convert from long integers |
| 1317 | - New built-in function: |
| 1318 | - pow(x, y) returns x to the power y |
| 1319 | - New operation and methods for lists: |
| 1320 | - l*n returns a new list consisting of n concatenated copies of l |
| 1321 | - l.remove(x) removes the first occurrence of the value x from l |
| 1322 | - l.index(x) returns the index of the first occurrence of x in l |
| 1323 | - l.reverse() reverses l in place |
| 1324 | - New operation for tuples: |
| 1325 | - t*n returns a tuple consisting of n concatenated copies of t |
| 1326 | - Improved file handling: |
| 1327 | - f.readline() no longer restricts the line length, is faster, |
| 1328 | and isn't confused by null bytes; same for raw_input() |
| 1329 | - f.read() without arguments reads the entire (rest of the) file |
| 1330 | - mixing of print and sys.stdout.write() has different effect |
| 1331 | - New methods for files: |
| 1332 | - f.readlines() returns a list containing the lines of the file, |
| 1333 | as read with f.readline() |
| 1334 | - f.flush(), f.tell(), f.seek() call their stdio counterparts |
| 1335 | - f.isatty() tests for "tty-ness" |
| 1336 | - New posix functions: |
| 1337 | - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait() |
| 1338 | - popen() returns a file object connected to a pipe |
| 1339 | - utime() replaces utimes() (the latter is not a POSIX name) |
| 1340 | - New stdwin features, including: |
| 1341 | - font handling |
| 1342 | - color drawing |
| 1343 | - scroll bars made optional |
| 1344 | - polygons |
| 1345 | - filled and xor shapes |
| 1346 | - text editing objects now have a 'settext' method |
| 1347 | |
| 1348 | |
| 1349 | 3. Changes to the standard library |
| 1350 | |
| 1351 | - Name change: the functions path.cat and macpath.cat are now called |
| 1352 | path.join and macpath.join |
| 1353 | - Added new modules: formatter, mutex, persist, sched, mainloop |
| 1354 | - Added some modules and functionality to the "widget set" (which is |
| 1355 | still under development, so please bear with me): |
| 1356 | DirList, FormSplit, TextEdit, WindowSched |
| 1357 | - Fixed module testall to work non-interactively |
| 1358 | - Module string: |
| 1359 | - added functions join() and joinfields() |
| 1360 | - fixed center() to work correct and make it "transitive" |
| 1361 | - Obsolete modules were removed: util, minmax |
| 1362 | - Some modules were moved to the demo directory |
| 1363 | |
| 1364 | |
| 1365 | 4. Changes to the demonstration programs |
| 1366 | |
| 1367 | - Added new useful scipts: byteyears, eptags, fact, from, lfact, |
| 1368 | objgraph, pdeps, pi, primes, ptags, which |
| 1369 | - Added a bunch of socket demos |
| 1370 | - Doubled the speed of ptags |
| 1371 | - Added new stdwin demos: microedit, miniedit |
| 1372 | - Added a windowing interface to the Python interpreter: python (most |
| 1373 | useful on the Mac) |
| 1374 | - Added a browser for Emacs info files: demo/stdwin/ibrowse |
| 1375 | (yes, I plan to put all STDWIN and Python documentation in texinfo |
| 1376 | form in the future) |
| 1377 | |
| 1378 | |
| 1379 | 5. Other changes to the distribution |
| 1380 | |
| 1381 | - An Emacs Lisp file "python.el" is provided to facilitate editing |
| 1382 | Python programs in GNU Emacs (slightly improved since posted to |
| 1383 | gnu.emacs.sources) |
| 1384 | - Some info on writing an extension in C is provided |
| 1385 | - Some info on building Python on non-UNIX platforms is provided |
| 1386 | |
| 1387 | |
| 1388 | ===================================== |
| 1389 | ==> Release 0.9.1 (February 1991) <== |
| 1390 | ===================================== |
| 1391 | |
| 1392 | - Micro changes only |
| 1393 | - Added file "patchlevel.h" |
| 1394 | |
| 1395 | |
| 1396 | ===================================== |
| 1397 | ==> Release 0.9.0 (February 1991) <== |
| 1398 | ===================================== |
| 1399 | |
| 1400 | Original posting to alt.sources. |