Ned Deily | 07a1892 | 2018-01-31 18:12:38 -0500 | [diff] [blame] | 1 | **************************** |
| 2 | What's New In Python 3.8 |
| 3 | **************************** |
| 4 | |
| 5 | :Release: |release| |
| 6 | :Date: |today| |
| 7 | |
| 8 | .. Rules for maintenance: |
| 9 | |
| 10 | * Anyone can add text to this document. Do not spend very much time |
| 11 | on the wording of your changes, because your text will probably |
| 12 | get rewritten to some degree. |
| 13 | |
| 14 | * The maintainer will go through Misc/NEWS periodically and add |
| 15 | changes; it's therefore more important to add your changes to |
| 16 | Misc/NEWS than to this file. |
| 17 | |
| 18 | * This is not a complete list of every single change; completeness |
| 19 | is the purpose of Misc/NEWS. Some changes I consider too small |
| 20 | or esoteric to include. If such a change is added to the text, |
| 21 | I'll just remove it. (This is another reason you shouldn't spend |
| 22 | too much time on writing your addition.) |
| 23 | |
| 24 | * If you want to draw your new text to the attention of the |
| 25 | maintainer, add 'XXX' to the beginning of the paragraph or |
| 26 | section. |
| 27 | |
| 28 | * It's OK to just add a fragmentary note about a change. For |
| 29 | example: "XXX Describe the transmogrify() function added to the |
| 30 | socket module." The maintainer will research the change and |
| 31 | write the necessary text. |
| 32 | |
| 33 | * You can comment out your additions if you like, but it's not |
| 34 | necessary (especially when a final release is some months away). |
| 35 | |
| 36 | * Credit the author of a patch or bugfix. Just the name is |
| 37 | sufficient; the e-mail address isn't necessary. |
| 38 | |
| 39 | * It's helpful to add the bug/patch number as a comment: |
| 40 | |
| 41 | XXX Describe the transmogrify() function added to the socket |
| 42 | module. |
| 43 | (Contributed by P.Y. Developer in :issue:`12345`.) |
| 44 | |
| 45 | This saves the maintainer the effort of going through the Mercurial log |
| 46 | when researching a change. |
| 47 | |
| 48 | This article explains the new features in Python 3.8, compared to 3.7. |
| 49 | |
| 50 | For full details, see the :source:`Misc/NEWS` file. |
| 51 | |
| 52 | .. note:: |
| 53 | |
| 54 | Prerelease users should be aware that this document is currently in draft |
| 55 | form. It will be updated substantially as Python 3.8 moves towards release, |
| 56 | so it's worth checking back even after reading earlier versions. |
| 57 | |
| 58 | |
| 59 | Summary -- Release highlights |
| 60 | ============================= |
| 61 | |
| 62 | .. This section singles out the most important changes in Python 3.8. |
| 63 | Brevity is key. |
| 64 | |
| 65 | |
| 66 | .. PEP-sized items next. |
| 67 | |
| 68 | |
| 69 | |
| 70 | New Features |
| 71 | ============ |
| 72 | |
| 73 | |
| 74 | |
| 75 | Other Language Changes |
| 76 | ====================== |
| 77 | |
Serhiy Storchaka | a445feb | 2018-02-10 00:08:17 +0200 | [diff] [blame] | 78 | * Added support of ``\N{name}`` escapes in :mod:`regular expressions <re>`. |
| 79 | (Contributed by Jonathan Eunice and Serhiy Storchaka in :issue:`30688`.) |
Ned Deily | 07a1892 | 2018-01-31 18:12:38 -0500 | [diff] [blame] | 80 | |
| 81 | |
| 82 | New Modules |
| 83 | =========== |
| 84 | |
| 85 | * None yet. |
| 86 | |
| 87 | |
| 88 | Improved Modules |
| 89 | ================ |
| 90 | |
| 91 | |
| 92 | Optimizations |
| 93 | ============= |
| 94 | |
| 95 | |
| 96 | Build and C API Changes |
| 97 | ======================= |
| 98 | |
| 99 | |
| 100 | |
| 101 | Deprecated |
| 102 | ========== |
| 103 | |
| 104 | |
| 105 | |
| 106 | Removed |
| 107 | ======= |
| 108 | |
| 109 | |
| 110 | |
| 111 | Porting to Python 3.8 |
| 112 | ===================== |
| 113 | |
| 114 | This section lists previously described changes and other bugfixes |
| 115 | that may require changes to your code. |
| 116 | |
| 117 | |
Serhiy Storchaka | 07ca9af | 2018-02-04 10:53:48 +0200 | [diff] [blame] | 118 | Changes in Python behavior |
| 119 | -------------------------- |
| 120 | |
| 121 | * Yield expressions (both ``yield`` and ``yield from`` clauses) are now disallowed |
| 122 | in comprehensions and generator expressions (aside from the iterable expression |
| 123 | in the leftmost :keyword:`for` clause). |
| 124 | (Contributed by Serhiy Storchaka in :issue:`10544`.) |
| 125 | |
| 126 | |
Serhiy Storchaka | 97f1ca1 | 2018-02-01 18:49:21 +0200 | [diff] [blame] | 127 | Changes in the Python API |
| 128 | ------------------------- |
| 129 | |
| 130 | * The :meth:`~tkinter.ttk.Treeview.selection` method of the |
| 131 | :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it with |
| 132 | arguments for changing the selection was deprecated in Python 3.6. Use |
| 133 | specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for |
| 134 | changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.) |
Serhiy Storchaka | 6c85efa5 | 2018-02-05 22:47:31 +0200 | [diff] [blame] | 135 | |
| 136 | * A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. |
| 137 | :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates |
| 138 | a database if it does not exist. |
| 139 | (Contributed by Serhiy Storchaka in :issue:`32749`.) |
Serhiy Storchaka | 520b7ae | 2018-02-22 23:33:30 +0200 | [diff] [blame^] | 140 | |
| 141 | |
| 142 | CPython bytecode changes |
| 143 | ------------------------ |
| 144 | |
| 145 | * The interpreter loop has been simplified by moving the logic of unrolling |
| 146 | the stack of blocks into the compiler. The compiler emits now explicit |
| 147 | instructions for adjusting the stack of values and calling the cleaning |
| 148 | up code for :keyword:`break`, :keyword:`continue` and :keyword:`return`. |
| 149 | |
| 150 | Removed opcodes :opcode:`BREAK_LOOP`, :opcode:`CONTINUE_LOOP`, |
| 151 | :opcode:`SETUP_LOOP` and :opcode:`SETUP_EXCEPT`. Added new opcodes |
| 152 | :opcode:`ROT_FOUR`, :opcode:`BEGIN_FINALLY`, :opcode:`CALL_FINALLY` and |
| 153 | :opcode:`POP_FINALLY`. Changed the behavior of :opcode:`END_FINALLY` |
| 154 | and :opcode:`WITH_CLEANUP_START`. |
| 155 | |
| 156 | (Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in |
| 157 | :issue:`17611`.) |