Znaczące zmiany wprowadzone w każdej wersji Pythona 3
hejto.plPython 3.0 (2008-12-03):
-
print statement replaced with a print() function
-
dict.iterkeys(), dict.iteritems(), and dict.itervalues() removed
-
Python 2’s xrange() is Python 3’s range(); Python 2’s range() is no more
-
Python 2’s str is Python 3’s bytes; Python 2’s unicode is Python 3’s str
-
The default Python source encoding is now UTF-8
-
urllib2 module split into urllib.request and urllib.error modules
-
urlparse module renamed to urllib.parse
-
urllib module split into urllib.parse, urllib.request, and urllib.error modules
Python 3.1 (2009-06-26):
-
The fields in strings formatted with str.format() can now omit numbering in order to be automatically numbered, as in 'Sir {} of {}'.format('Gallahad', 'Camelot')
-
round(x, n) now returns an integer if x is an integer
-
collections module: Counter and OrderedDict added
Python 3.2 (2011-02-20)
-
New modules: argparse, concurrent.futures, html, and sysconfig
-
.pyc files are now stored in __pycache__/ directories
-
datetime module: timezone added
Python 3.3 (2012-09-29)
-
New modules: faulthandler, ipaddress, lzma, unittest.mock, and venv
-
Support for implicit namespace packages (directories without an __init__.py) added
-
datetime module: New datetime methods: timestamp(), strftime(), and astimezone()
Python 3.4 (2014-03-17)
-
New modules: asyncio, ensurepip, enum, pathlib, selectors, statistics, and tracemalloc
-
http.server command-line interface: --bind option added
Python 3.5 (2015-09-13)
-
Coroutine functions (async def), awaitable objects (await and __await__()), asynchronous iteration (async for, __aiter__(), and __anext__()), and asynchronous context managers (async with, __aenter__(), and __aexit__()) added
-
Multiple * and/or ** unpackings can now be used in a single function call
-
New modules: typing and zipapp
-
Various additions & improvements to the asyncio module
Python 3.6 (2016-12-23)
-
Formatted string literals (“f-strings”)
-
Variables can now be annotated by following the name of the variable with a colon and the annotation
-
Underscores can now be used in numeric literals
-
await and yield can now be used in the same function, thereby enabling asynchronous generators
-
async for can now be used in list, set, & dict comprehensions and in generator expressions
-
await expressions can now be used in any comprehension
-
**kwargs now preserves insertion order
-
dicts are now implemented in such a way that they preserve insertion order
-
Various additions & improvements to the asyncio module
Python 3.7 (2018-06-27)
-
dicts are now guaranteed to preserve insertion order
-
async and await are now reserved keywords
-
New modules: contextvars, dataclasses, importlib.resources
Python 3.8 (2019-10-14)
-
Assignment expressions: := (the “walrus operator”) can now be used to assign a value to a variable in the middle of an expression
-
Function parameters can now be made positional-only by placing a / after them in the argument list
Python 3.9 (2020-10-05)
-
dicts can now be merged & updated using the | and |= operators
-
New modules: graphlib and zoneinfo
-
asyncio module: to_thread() added
-
Removed: asyncio.Task.current_task() and asyncio.Task.all_tasks() (deprecated since Python 3.7); use asyncio.current_task() and asyncio.all_tasks() instead
Python 3.10 (2021-10-04)
-
Pattern matching with match/case syntax
-
Common syntax errors now have better error messages
Python 3.11 (2022-10-03)
-
Exception groups
-
Traceback messages now highlight the exact expression that caused the error
-
New modules: tomllib and wsgiref.types
#technologia #programowanie #python