Georg Brandl | c47408a | 2008-12-04 18:44:53 +0000 | [diff] [blame] | 1 | **************************** |
| 2 | What's New In Python 3.1 |
| 3 | **************************** |
| 4 | |
| 5 | .. XXX Add trademark info for Apple, Microsoft. |
| 6 | |
| 7 | :Author: No one so far |
Benjamin Peterson | 3432829 | 2008-12-05 03:05:29 +0000 | [diff] [blame] | 8 | :Release: |release| |
| 9 | :Date: |today| |
Georg Brandl | c47408a | 2008-12-04 18:44:53 +0000 | [diff] [blame] | 10 | |
| 11 | .. $Id$ |
| 12 | Rules for maintenance: |
| 13 | |
| 14 | * Anyone can add text to this document. Do not spend very much time |
| 15 | on the wording of your changes, because your text will probably |
| 16 | get rewritten to some degree. |
| 17 | |
| 18 | * The maintainer will go through Misc/NEWS periodically and add |
| 19 | changes; it's therefore more important to add your changes to |
| 20 | Misc/NEWS than to this file. (Note: I didn't get to this for 3.0. |
| 21 | GvR.) |
| 22 | |
| 23 | * This is not a complete list of every single change; completeness |
| 24 | is the purpose of Misc/NEWS. Some changes I consider too small |
| 25 | or esoteric to include. If such a change is added to the text, |
| 26 | I'll just remove it. (This is another reason you shouldn't spend |
| 27 | too much time on writing your addition.) |
| 28 | |
| 29 | * If you want to draw your new text to the attention of the |
| 30 | maintainer, add 'XXX' to the beginning of the paragraph or |
| 31 | section. |
| 32 | |
| 33 | * It's OK to just add a fragmentary note about a change. For |
| 34 | example: "XXX Describe the transmogrify() function added to the |
| 35 | socket module." The maintainer will research the change and |
| 36 | write the necessary text. |
| 37 | |
| 38 | * You can comment out your additions if you like, but it's not |
| 39 | necessary (especially when a final release is some months away). |
| 40 | |
| 41 | * Credit the author of a patch or bugfix. Just the name is |
| 42 | sufficient; the e-mail address isn't necessary. (Due to time |
| 43 | constraints I haven't managed to do this for 3.0. GvR.) |
| 44 | |
| 45 | * It's helpful to add the bug/patch number as a comment: |
| 46 | |
| 47 | % Patch 12345 |
| 48 | XXX Describe the transmogrify() function added to the socket |
| 49 | module. |
| 50 | (Contributed by P.Y. Developer.) |
| 51 | |
| 52 | This saves the maintainer the effort of going through the SVN log |
| 53 | when researching a change. (Again, I didn't get to this for 3.0. |
| 54 | GvR.) |
| 55 | |
| 56 | This article explains the new features in Python 3.1, compared to 3.0. |
| 57 | |
| 58 | .. Compare with previous release in 2 - 3 sentences here. |
| 59 | .. add hyperlink when the documentation becomes available online. |
| 60 | |
| 61 | .. ====================================================================== |
| 62 | .. Large, PEP-level features and changes should be described here. |
| 63 | .. Should there be a new section here for 3k migration? |
| 64 | .. Or perhaps a more general section describing module changes/deprecation? |
| 65 | .. sets module deprecated |
| 66 | .. ====================================================================== |
| 67 | |
| 68 | |
Mark Dickinson | 54bc1ec | 2008-12-17 16:19:07 +0000 | [diff] [blame^] | 69 | Other Language Changes |
| 70 | ====================== |
| 71 | |
| 72 | Some smaller changes made to the core Python language are: |
| 73 | |
| 74 | * The :func:`int` type gained a ``bit_length`` method that returns the |
| 75 | number of bits necessary to represent its argument in binary:: |
| 76 | |
| 77 | >>> n = 37 |
| 78 | >>> bin(37) |
| 79 | '0b100101' |
| 80 | >>> n.bit_length() |
| 81 | 6 |
| 82 | >>> n = 2**123-1 |
| 83 | >>> n.bit_length() |
| 84 | 123 |
| 85 | >>> (n+1).bit_length() |
| 86 | 124 |
| 87 | |
| 88 | (Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.) |
| 89 | |
| 90 | |
Georg Brandl | c47408a | 2008-12-04 18:44:53 +0000 | [diff] [blame] | 91 | .. ====================================================================== |