https://docs.python.org/3/whatsnew/3.6.html
- PEP 498: Formatted string literals
- PEP 526: Syntax for variable annotations
- PEP 515: Underscores in Numeric Literals
- PEP 525: Asynchronous Generators
- PEP 530: Asynchronous Comprehensions
- PEP 487: Simpler customization of class creation
- PEP 487: Descriptor Protocol Enhancements
- PEP 519: Adding a file system path protocol
- PEP 495: Local Time Disambiguation
- PEP 529: Change Windows filesystem encoding to UTF-8
- PEP 528: Change Windows console encoding to UTF-8
- PEP 520: Preserving Class Attribute Definition Order
- PEP 468: Preserving Keyword Argument Order
- PEP 523: Adding a frame evaluation API to CPython
- A
global
ornonlocal
statement must now textually appear before the first use of the affected name in the same scope. Previously this was aSyntaxWarning
. - It is now possible to set a special method to
None
to indicate that the corresponding operation is not available. For example, if a class sets__iter__()
toNone
, the class is not iterable. - Long sequences of repeated traceback lines are now abbreviated as
"[Previous line repeated {count} more times]"
(see traceback for an example). - Import now raises the new exception
ModuleNotFoundError
(subclass ofImportError
) when it cannot find a module. Code that currently checks forImportError
(in try-except) will still work. - Class methods relying on zero-argument
super()
will now work correctly when called from metaclass methods during class creation.
-
secrets
-
array
-
ast
-
asyncio
-
binascii
-
cmath
-
collections
-
concurrent.futures
-
contextlib
-
datetime
-
decimal
-
distutils
-
email
-
encodings
-
enum
-
faulthandler
-
fileinput
-
hashlib
-
http.client
-
idlelib and IDLE
-
importlib
-
inspect
-
json
-
logging
-
math
-
multiprocessing
-
operator
-
os
-
pathlib
-
pdb
-
pickle
-
pickletools
-
pydoc
-
random
-
re
-
readline
-
rlcompleter
-
shlex
-
site
-
sqlite3
-
socket
-
socketserver
-
ssl
-
statistics
-
struct
-
subprocess
-
sys
-
telnetlib
-
time
-
timeit
-
tkinter
-
traceback
-
tracemalloc
-
typing
-
unicodedata
-
unittest.mock
-
urllib.requests
-
urllib.robotparser
-
venv
-
warnings
-
winreg
-
winsound
-
xmlrpc.client
-
zipfile
-
zlib
- When
--version
(short form:-V
) is supplied twice, Python printssys.version
for detailed information.
-
async
andawait
are not recommended to be used as variable, class, function or module names. Introduced by PEP 492 in Python 3.5, they will become proper keywords in Python 3.7. Starting in Python 3.6, the use ofasync
orawait
as names will generate aDeprecationWarning
.
- Raising the
StopIteration
exception inside a generator will now generate aDeprecationWarning
and will trigger aRuntimeError
in Python 3.7. See PEP 479: Change StopIteration handling inside generators for details. - The
__aiter__()
method is now expected to return an asynchronous iterator directly instead of returning an awaitable as previously. Doing the former will trigger aDeprecationWarning
. Backward compatibility will be removed in Python 3.7. - A backslash-character pair that is not a valid escape sequence now generates a
DeprecationWarning
. Although this will eventually become aSyntaxError
, that will not be for several Python releases. - When performing a relative import, falling back on
__name__
and__path__
from the calling module when__spec__
or__package__
are not defined now raises anImportWarning
.
- The
asynchat
has been deprecated in favor ofasyncio
. - The
asyncore
has been deprecated in favor ofasyncio
. - Unlike other
dbm
implementations, thedbm.dumb
module creates databases with the'rw'
mode and allows modifying the database opened with the'r'
mode. This behavior is now deprecated and will be removed in 3.8. - The undocumented
extra_path
argument to theDistribution
constructor is now considered deprecated and will raise a warning if set. Support for this parameter will be removed in a future Python release. See bpo-27919 for details. - The support of non-integer arguments in
getgrgid()
has been deprecated. - The
importlib.machinery.SourceFileLoader.load_module()
andimportlib.machinery.SourcelessFileLoader.load_module()
methods are now deprecated. They were the only remaining implementations ofimportlib.abc.Loader.load_module()
inimportlib
that had not been deprecated in previous versions of Python in favour ofimportlib.abc.Loader.exec_module()
. - The
importlib.machinery.WindowsRegistryFinder
class is now deprecated. As of 3.6.0, it is still added tosys.meta_path
by default (on Windows), but this may change in future releases. - Undocumented support of general bytes-like objects as paths in
os
functions,compile()
and similar functions is now deprecated. - Support for inline flags
(?letters)
in the middle of the regular expression has been deprecated and will be removed in a future Python version. Flags at the start of a regular expression are still allowed. - OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. In the future the
ssl
module will require at least OpenSSL 1.0.2 or 1.1.0.. - SSL-related arguments like
certfile
,keyfile
andcheck_hostname
inftplib
,http.client
,imaplib
,poplib
, andsmtplib
have been deprecated in favor ofcontext
. - A couple of protocols and functions of the
ssl
module are now deprecated. Some features will no longer be available in future versions of OpenSSL. Other features are deprecated in favor of a different API. - The
tkinter.tix
module is now deprecated.tkinter
users should usetkinter.ttk
instead. - The
pyvenv
script has been deprecated in favour ofpython3 -m venv
. This prevents confusion as to what Python interpreterpyvenv
is connected to and thus what Python interpreter will be used by the virtual environment.
- Unknown escapes consisting of
'\'
and an ASCII letter in regular expressions will now cause an error. In replacement templates forre.sub()
they are still allowed, but deprecated. There.LOCALE
flag can now only be used with binary patterns. -
inspect.getmoduleinfo()
was removed (was deprecated since CPython 3.3).inspect.getmodulename()
should be used for obtaining the module name for a given path. -
traceback.Ignore
class andtraceback.usage
,traceback.modname
,traceback.fullmodname
,traceback.find_lines_from_code
,traceback.find_lines
,traceback.find_strings
,traceback.find_executable_lines
methods were removed from thetraceback
module. They were undocumented methods deprecated since Python 3.2 and equivalent functionality is available from private methods. - The
tk_menuBar()
andtk_bindForTraversal()
dummy methods intkinter
widget classes were removed (corresponding Tk commands were obsolete since Tk 4.0). - The
open()
method of thezipfile.ZipFile
class no longer supports the'U'
mode (was deprecated since Python 3.4). Useio.TextIOWrapper
for reading compressed text files in universal newlines mode. - The undocumented
IN
,CDROM
,DLFCN
,TYPES
,CDIO
, andSTROPTS
modules have been removed. They had been available in the platform specificLib/plat-*/
directories, but were chronically out of date, inconsistently available across platforms, and unmaintained. The script that created these modules is still available in the source distribution at Tools/scripts/h2py.py. - The deprecated
asynchat.fifo
class has been removed.