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
e3b8f7c0
Commit
e3b8f7c0
authored
Jan 26, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Markup nits.
parent
bdd2d93b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
Doc/whatsnew/3.2.rst
Doc/whatsnew/3.2.rst
+26
-18
No files found.
Doc/whatsnew/3.2.rst
View file @
e3b8f7c0
...
...
@@ -954,19 +954,21 @@ datetime and time
Starting with Py3.2, use of the century guessing heuristic will emit a
:exc:`DeprecationWarning`. Instead, it is recommended that
:attr:`time.accept2dyear` be set to *False* so that large date ranges
can be used without guesswork:
>>> import time, warnings
>>> warnings.resetwarnings() # remove the default warning filters
>>> time.accept2dyear = True # guess whether 11 means 11 or 2011
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
Warning (from warnings module):
...
DeprecationWarning: Century info guessed for a 2-digit year.
'Fri Jan 1 12:34:56 2011'
>>> time.accept2dyear = False # use the full range of allowable dates
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
'Fri Jan 1 12:34:56 11'
can be used without guesswork::
>>> import time, warnings
>>> warnings.resetwarnings() # remove the default warning filters
>>> time.accept2dyear = True # guess whether 11 means 11 or 2011
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
Warning (from warnings module):
...
DeprecationWarning: Century info guessed for a 2-digit year.
'Fri Jan 1 12:34:56 2011'
>>> time.accept2dyear = False # use the full range of allowable dates
>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
'Fri Jan 1 12:34:56 11'
Several functions now have significantly expanded date ranges. When
:attr:`time.accept2dyear` is false, the :func:`time.asctime` function will
...
...
@@ -1080,7 +1082,7 @@ string.
To help write such :meth:`__repr__` methods, the :mod:`reprlib` module has a new
decorator, :func:`~reprlib.recursive_repr`, for detecting recursive calls to
:meth:`__repr__` and substituting a placeholder string instead:
:meth:`__repr__` and substituting a placeholder string instead:
:
>>> class MyList(list):
@recursive_repr()
...
...
@@ -1235,9 +1237,9 @@ connection when done::
>>> from ftplib import FTP
>>> with FTP("ftp1.at.proftpd.org") as ftp:
...
ftp.login()
...
ftp.dir()
...
ftp.login()
ftp.dir()
'230 Anonymous login ok, restrictions apply.'
dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 .
dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 ..
...
...
@@ -1321,11 +1323,13 @@ hashlib
The :mod:`hashlib` module has two new constant attributes listing the hashing
algorithms guaranteed to be present in all implementations and those available
on the current implementation:
on the current implementation:
:
>>> import hashlib
>>> hashlib.algorithms_guaranteed
{'sha1', 'sha224', 'sha384', 'sha256', 'sha512', 'md5'}
>>> hashlib.algorithms_available
{'md2', 'SHA256', 'SHA512', 'dsaWithSHA', 'mdc2', 'SHA224', 'MD4', 'sha256',
'sha512', 'ripemd160', 'SHA1', 'MDC2', 'SHA', 'SHA384', 'MD2',
...
...
@@ -1345,6 +1349,7 @@ the builtin :func:`eval` function which is easily abused. Python 3.2 adds
strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
::
>>> from ast import literal_request
>>> request = "{'req': 3, 'func': 'pow', 'args': (2, 0.5)}"
...
...
@@ -1406,17 +1411,20 @@ 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 # show the name of archive
'/var/backup/mydata.zip'
>>> os.chdir('tmp') # change to an unpacking
>>> shutil.unpack_archive('/var/backup/mydata.zip') # recover the data
>>> pprint.pprint(shutil.get_archive_formats()) # display known formats
[('bztar', "bzip2'ed tar-file"),
('gztar', "gzip'ed tar-file"),
('tar', 'uncompressed tar file'),
('zip', 'ZIP file')]
>>> shutil.register_archive_format( # register a new archive format
name = 'xz',
function = 'xz.compress',
...
...
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