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
fb2d167e
Commit
fb2d167e
authored
Feb 06, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11071: Various improvements to whatsnew.
parent
810cd347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
19 deletions
+50
-19
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+50
-19
No files found.
Doc/whatsnew/3.2.rst
View file @
fb2d167e
...
...
@@ -513,6 +513,7 @@ Some smaller changes made to the core Python language are:
caused confusion and is no longer needed now that the shortest possible
:func:`repr` is displayed by default:
>>> import math
>>> repr(math.pi)
'3.141592653589793'
>>> str(math.pi)
...
...
@@ -633,11 +634,10 @@ Some smaller changes made to the core Python language are:
(See :issue:`10518`.)
* Python's import mechanism can now load modules installed in directories with
non-ASCII characters in the path name:
non-ASCII characters in the path name. This solved an aggravating problem
with home directories for users with non-ASCII characters in their usernames.
>>> import møøse.bites
(Required extensive work by Victor Stinner in :issue:`9425`.)
(Required extensive work by Victor Stinner in :issue:`9425`.)
New, Improved, and Deprecated Modules
...
...
@@ -646,14 +646,15 @@ New, Improved, and Deprecated Modules
Python's standard library has undergone significant maintenance efforts and
quality improvements.
The biggest news for Python 3.2 is that the :mod:`email` package and
:mod:`nntplib` modules now work correctly with the bytes/text model in Python 3.
For the first time, there is correct handling of inputs with mixed encodings.
The biggest news for Python 3.2 is that the :mod:`email` package, :mod:`mailbox`
module, and :mod:`nntplib` modules now work correctly with the bytes/text model
in Python 3. For the first time, there is correct handling of message with
mixed encodings.
Throughout the standard library, there has been more careful attention to
encodings and text versus bytes issues. In particular, interactions with the
operating system are now better able to
pass non-ASCII data using the Windows
MBCS encoding, locale-aware encodings, or UTF-8.
operating system are now better able to
exchange non-ASCII data using the
Windows
MBCS encoding, locale-aware encodings, or UTF-8.
Another significant win is the addition of substantially better support for
*SSL* connections and security certificates.
...
...
@@ -822,6 +823,7 @@ itertools
* The :mod:`itertools` module has a new :func:`~itertools.accumulate` function
modeled on APL's *scan* operator and Numpy's *accumulate* function:
>>> from itertools import accumulate
>>> list(accumulate(8, 2, 50))
[8, 10, 60]
...
...
@@ -911,6 +913,8 @@ back and re-enter the barrier. The barrier fully resets after each cycle.
Example of using barriers::
from threading import Barrier, Thread
def get_votes(site):
ballots = conduct_election(site)
all_polls_closed.wait() # do not count until all polls are closed
...
...
@@ -964,7 +968,7 @@ datetime and time
offset and timezone name. This makes it easier to create timezone-aware
datetime objects::
>>>
import datetim
e
>>>
from datetime import datetime, timezon
e
>>> datetime.now(timezone.utc)
datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone.utc)
...
...
@@ -1069,12 +1073,12 @@ These tools make it possible to define an :term:`abstract base class` that
requires a particular :func:`classmethod` or :func:`staticmethod` to be
implemented::
class Temperature(metaclass=ABCMeta):
class Temperature(metaclass=
abc.
ABCMeta):
@abc.abstractclassmethod
def from_fahrenheit(
self
, t):
def from_fahrenheit(
cls
, t):
...
@abc.abstractclassmethod
def from_celsius(
self
, t):
def from_celsius(
cls
, t):
...
(Patch submitted by Daniel Urban; :issue:`5867`.)
...
...
@@ -1104,8 +1108,8 @@ for slice notation are well-suited to in-place editing::
>>> change_location(buffer, 1, b'warehouse ')
>>> change_location(buffer, 0, b'showroom ')
>>> print(byte_stream.getvalue())
b'G3805 showroom Main chassis '
->
b'X7899 warehouse Reserve cog '
->
b'G3805 showroom Main chassis '
b'X7899 warehouse Reserve cog '
b'L6988 receiving Primary sprocket'
(Contributed by Antoine Pitrou in :issue:`5506`.)
...
...
@@ -1425,7 +1429,7 @@ strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
::
>>> from ast import literal_
request
>>> from ast import literal_
eval
>>> request = "{'req': 3, 'func': 'pow', 'args': (2, 0.5)}"
>>> literal_eval(request)
...
...
@@ -1491,7 +1495,8 @@ step is non-destructive (the original files are left unchanged).
>>> import shutil, pprint
>>> os.chdir('mydata') # change to the source directory
>>> f = make_archive('/var/backup/mydata', 'zip') # archive the current directory
>>> f = shutil.make_archive('/var/backup/mydata',
'zip') # archive the current directory
>>> f # show the name of archive
'/var/backup/mydata.zip'
>>> os.chdir('tmp') # change to an unpacking
...
...
@@ -1505,8 +1510,8 @@ step is non-destructive (the original files are left unchanged).
>>> shutil.register_archive_format( # register a new archive format
name = 'xz',
function =
'xz.compress',
extra_args = [('level', 8)],
function =
xz.compress, # callable archiving function
extra_args = [('level', 8)],
# arguments to the function
description = 'xz compression'
)
...
...
@@ -1879,6 +1884,32 @@ object. The former returns a string and the latter prints it::
1: seq
2: i
In addition, the :func:`~dis.dis` function now accepts string arguments
so that the common idiom ``dis(compile(s, '', 'eval'))`` can be shortened
to ``dis(compile(s))``::
>>> dis('3*x+1 if x%2==1 else x//2')
1 0 LOAD_NAME 0 (x)
3 LOAD_CONST 0 (2)
6 BINARY_MODULO
7 LOAD_CONST 1 (1)
10 COMPARE_OP 2 (==)
13 POP_JUMP_IF_FALSE 28
16 LOAD_CONST 2 (3)
19 LOAD_NAME 0 (x)
22 BINARY_MULTIPLY
23 LOAD_CONST 1 (1)
26 BINARY_ADD
27 RETURN_VALUE
>> 28 LOAD_NAME 0 (x)
31 LOAD_CONST 0 (2)
34 BINARY_FLOOR_DIVIDE
35 RETURN_VALUE
Taken together, these improvements make it easier to explore how CPython is
implemented and to see for yourself what the language syntax does
under-the-hood.
(Contributed by Nick Coghlan in :issue:`9147`.)
dbm
...
...
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