|
53 | 53 | when researching a change. |
54 | 54 |
|
55 | 55 | This article explains the new features in Python 3.0, compared to 2.6. |
56 | | -Python 3.0, also known as "Python 3000" or "Py3k", is the first ever |
| 56 | +Python 3.0, also known as "Python 3000" or "Py3K", is the first ever |
57 | 57 | *intentionally incompatible* release. There are more changes than in |
58 | 58 | a typical release, and more that are important for all Python users. |
59 | 59 | Nevertheless, after digesting the changes, you'll find that Python |
@@ -247,7 +247,6 @@ Overview Of Syntactic Changes |
247 | 247 | ============================= |
248 | 248 |
|
249 | 249 | This section gives a brief overview of every *syntactic* change. |
250 | | -Several of these are discussed at greater length later. |
251 | 250 |
|
252 | 251 | Additions |
253 | 252 | --------- |
@@ -426,49 +425,105 @@ consulted for longer descriptions. |
426 | 425 | Library Changes |
427 | 426 | =============== |
428 | 427 |
|
429 | | -Due to time constraints, this document does not exhaustively cover |
430 | | -the very extensive changes to the library. |
431 | | - |
432 | | -XXX Brief overview of what's changed in the library. |
433 | | - |
434 | | -* :pep:`3108`: stdlib reorganization. |
| 428 | +Due to time constraints, this document does not exhaustively cover the |
| 429 | +very extensive changes to the standard library. :pep:`3108` is the |
| 430 | +reference for the major changes to the library. Here's a capsule |
| 431 | +review: |
| 432 | + |
| 433 | +* Many old modules were removed. Some, like :mod:`gopherlib` (no |
| 434 | + longer used) and :mod:`md5` (replaced by :mod:`hashlib`), were |
| 435 | + already deprecated by :pep:`0004`. Others were removed as a result |
| 436 | + of the removal of support for various platforms such as Irix, BeOS |
| 437 | + and Mac OS 9 (see :pep:`0011`). Some modules were also selected for |
| 438 | + removal in Python 3.0 due to lack of use or because a better |
| 439 | + replacement exists. See :pep:`3108` for an exhaustive list. |
| 440 | + |
| 441 | +* The :mod:`bsddb3` package was removed because its presence in the |
| 442 | + core standard library has proved over time to be a particular burden |
| 443 | + for the core developers due to testing instability and Berlekey DB's |
| 444 | + release schedule. However, the package is alive and well, |
| 445 | + externally maintained at http://www.jcea.es/programacion/pybsddb.htm. |
| 446 | + |
| 447 | +* Some modules were renamed because their old name flaunted |
| 448 | + :pep:`0008`, or for various other reasons: |
| 449 | + |
| 450 | + ======================= ======================= |
| 451 | + Old Name New Name |
| 452 | + ======================= ======================= |
| 453 | + _winreg winreg |
| 454 | + ConfigParser configparser |
| 455 | + copy_reg copyreg |
| 456 | + Queue queue |
| 457 | + SocketServer socketserver |
| 458 | + markupbase _markupbase |
| 459 | + repr reprlib |
| 460 | + test.test_support test.support |
| 461 | + ======================= ======================= |
| 462 | + |
| 463 | +* A common pattern in Python 2.x is to have one version of a module |
| 464 | + implemented in pure Python, with an optional accelerated version |
| 465 | + implemented as a C extension; for example, :mod:`pickle` and |
| 466 | + :mod:`cPickle`. This places the burden of importing the accelerated |
| 467 | + version and falling back on the pure Python version on each user of |
| 468 | + these modules. In Python 3.0, the accelerated versions are |
| 469 | + considered implementation details of the pure Python versions. |
| 470 | + Users should always import the standard version, which attempts to |
| 471 | + import the accelerated version and falls back to the pure Python |
| 472 | + version. The :mod:`pickle` module received this treatment. The |
| 473 | + :mod:`profile` module is on the list for 3.1. The :mod:`StringIO` |
| 474 | + module has been turned into a class in the :mod:`io` module. |
| 475 | + |
| 476 | +* Some related modules have been grouped into packages, and usually |
| 477 | + the submodule names have been simplified. The resulting new |
| 478 | + packages are: |
| 479 | + |
| 480 | + * :mod:`dbm` (:mod:`anydbm`, :mod:`dbhash`, :mod:`dbm`, |
| 481 | + :mod:`dumbdbm`, :mod:`gdbm`, :mod:`whichdb`). |
| 482 | + |
| 483 | + * :mod:`html` (:mod:`HTMLParser`, :mod:`htmlentitydefs`). |
| 484 | + |
| 485 | + * :mod:`http` (:mod:`httplib`, :mod:`BaseHTTPServer`, |
| 486 | + :mod:`CGIHTTPServer`, :mod:`SimpleHTTPServer`, :mod:`Cookie`, |
| 487 | + :mod:`cookielib`). |
| 488 | + |
| 489 | + * :mod:`tkinter` (all :mod:`Tkinter`-related modules except |
| 490 | + :mod:`turtle`). The target audience of :mod:`turtle` doesn't |
| 491 | + really care about :mod:`tkinter`. Also note that as of Python |
| 492 | + 2.6, the functionality of :mod:`turtle` has been greatly enhanced. |
| 493 | + |
| 494 | + * :mod:`urllib` (:mod:`urllib`, :mod:`urllib`2, :mod:`urlparse`, |
| 495 | + :mod:`robotparse`). |
| 496 | + |
| 497 | + * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, |
| 498 | + :mod:`SimpleXMLRPCServer`). |
| 499 | + |
| 500 | +Some other library changes (not covered by :pep:`3108`): |
435 | 501 |
|
436 | 502 | * Killed :mod:`sets`. Use the builtin :func:`set` function. |
437 | 503 |
|
438 | | -* XXX macfs, new, reconvert, stringold, xmllib, pcre, pypcre, strop |
439 | | - |
440 | | -* XXX :pep:`4` |
441 | | - |
442 | | -* XXX lib-old: Para, addpack, cmp, cmpcache, codehack, dircmp, dump, |
443 | | - find, fmt, grep, lockfile, newdir, ni, packmail, poly, rand, |
444 | | - statcache, tb, tzparse, util, whatsound, whrandom, zmod |
445 | | - |
446 | | -* XXX Removed sys.exitfunc |
447 | | - |
448 | | -* XXX Removed sys.exc_clear |
449 | | - |
450 | | -* XXX Removed sys.exc_type, exc_value, exc_traceback. (sys.last_type |
| 504 | +* Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, |
| 505 | + :func:`sys.exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, |
| 506 | + :data:`sys.exc_traceback`. (Note that :data:`sys.last_type` |
451 | 507 | etc. remain.) |
452 | 508 |
|
453 | | -* XXX array.read, array.write |
454 | | - |
455 | | -* XXX operator.sequenceIncludes |
456 | | - |
457 | | -* XXX thread.acquire_lock and thread.release_lock |
458 | | - |
459 | | -* XXX UserXXX -> XXXMixin? |
| 509 | +* Cleanup of the :class:`array.array` type: the :meth:`read` and |
| 510 | + :meth:`write` methods are gone; use :meth:`fromfile` and |
| 511 | + :meth:`tofile` instead. |
460 | 512 |
|
461 | | -* XXX removed random.jumpahead API |
| 513 | +* Cleanup of the :mod:`operator` module: removed |
| 514 | + :func:`sequenceIncludes` and :func:`isCallable`. |
462 | 515 |
|
463 | | -* XXX cookie module revamps |
| 516 | +* Cleanup of the :mod:`thread` module: :func:`acquire_lock` and |
| 517 | + :func:`release_lock` are gone; use :func:`acquire` and |
| 518 | + :func:`release` instead. |
464 | 519 |
|
465 | | -* XXX heapq revamp |
| 520 | +* Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API. |
466 | 521 |
|
467 | 522 |
|
468 | 523 | Strings And Bytes |
469 | 524 | ================= |
470 | 525 |
|
471 | | -This section discusses the many changes in string |
| 526 | +This section discusses the many changes in string XXX |
472 | 527 |
|
473 | 528 | * There is only one string type; its name is :class:`str` but its behavior and |
474 | 529 | implementation are like :class:`unicode` in 2.x. |
@@ -761,23 +816,6 @@ XXX Platform-specific changes go here. |
761 | 816 | .. ====================================================================== |
762 | 817 |
|
763 | 818 |
|
764 | | -.. _30section-other: |
765 | | - |
766 | | -Other Changes And Fixes |
767 | | -======================= |
768 | | - |
769 | | -As usual, there were a bunch of other improvements and bugfixes |
770 | | -scattered throughout the source tree. A search through the change |
771 | | -logs finds there were XXX patches applied and YYY bugs fixed between |
772 | | -Python 2.6 and 3.0. Both figures are likely to be underestimates. |
773 | | - |
774 | | -XXX Some of the more notable changes are: |
775 | | - |
776 | | -* XXX Details go here. |
777 | | - |
778 | | -.. ====================================================================== |
779 | | -
|
780 | | -
|
781 | 819 | Porting To Python 3.0 |
782 | 820 | ===================== |
783 | 821 |
|
|
0 commit comments