Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bb6f4f6c
Commit
bb6f4f6c
authored
Dec 15, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add entries for the random module and the collections module.
parent
22f03bec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
6 deletions
+31
-6
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+31
-6
No files found.
Doc/whatsnew/3.2.rst
View file @
bb6f4f6c
...
@@ -634,6 +634,22 @@ New, Improved, and Deprecated Modules
...
@@ -634,6 +634,22 @@ New, Improved, and Deprecated Modules
(Contributed by Raymond Hettinger.)
(Contributed by Raymond Hettinger.)
* The :class:`collections.OrderedDict` class has a new method
:meth:`~collections.OrderedDict.move_to_end` which takes an existing key and
moves it to either the beginning or end of an ordered sequence. When the
dictionary sequence is being used as a queue, these operations correspond to
"move to the front of the line" or "move to the back of the line":
>>> d = OrderedDict.fromkeys(['a', 'b', 'X', 'd', 'e'])
>>> list(d)
['a', 'b', 'X', 'd', 'e']
>>> d.move_to_end('X', last=True)
>>> list(d)
['a', 'b', 'd', 'e', 'X']
>>> d.move_to_end('X', last=False)
>>> list(d)
['X', 'a', 'b', 'd', 'e']
* The :mod:`datetime` module has a new type :class:`~datetime.timezone` that
* The :mod:`datetime` module has a new type :class:`~datetime.timezone` that
implements the :class:`~datetime.tzinfo` interface by returning a fixed UTC
implements the :class:`~datetime.tzinfo` interface by returning a fixed UTC
offset and timezone name. This makes it easier to create timezone aware
offset and timezone name. This makes it easier to create timezone aware
...
@@ -851,6 +867,15 @@ New, Improved, and Deprecated Modules
...
@@ -851,6 +867,15 @@ New, Improved, and Deprecated Modules
(Contributed by Ezio Melotti; :issue:`9424`.)
(Contributed by Ezio Melotti; :issue:`9424`.)
* The integer methods in the :mod:`random` module now do a better job of
producing uniform distributions. Previously, they used ``int(n*random())``
which had a slight bias whenever *n* was not a power of two. The methods
affected are :meth:`~random.Random.randrange`, :meth:`~random.Random.randint`,
:meth:`~random.Random.choice`, :meth:`~random.Random.shuffle` and
:meth:`~random.Random.sample`.
(Contributed by Raymond Hettinger; :issue:`9025`.)
* :class:`~poplib.POP3_SSL` class now accepts a *context* parameter, which is a
* :class:`~poplib.POP3_SSL` class now accepts a *context* parameter, which is a
:class:`ssl.SSLContext` object allowing bundling SSL configuration options,
:class:`ssl.SSLContext` object allowing bundling SSL configuration options,
certificates and private keys into a single (potentially long-lived)
certificates and private keys into a single (potentially long-lived)
...
@@ -1207,13 +1232,13 @@ require changes to your code:
...
@@ -1207,13 +1232,13 @@ require changes to your code:
instead; the new type has a well-defined interface for passing typing safety
instead; the new type has a well-defined interface for passing typing safety
information and a less complicated signature for calling a destructor.
information and a less complicated signature for calling a destructor.
* The :func:`sys.setfilesystemencoding` function was removed because
* The :func:`sys.setfilesystemencoding` function was removed because
it had a flawed design.
it had a flawed design.
* The :func:`random.seed` function and method now performing salting for
* The :func:`random.seed` function and method now salt string seeds with an
string seeds
. To access the previous version of *seed* in order to
sha512 hash function
. To access the previous version of *seed* in order to
reproduce Python 3.1 sequences, set the *version* argument to *1*,
reproduce Python 3.1 sequences, set the *version* argument to *1*,
``random.seed(s, version=1)``.
``random.seed(s, version=1)``.
* The previously deprecated :func:`string.maketrans` function has been removed
* The previously deprecated :func:`string.maketrans` function has been removed
in favor of the static methods, :meth:`bytes.maketrans` and
in favor of the static methods, :meth:`bytes.maketrans` and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment