Created 17 May 2022, last updated 19 May 2022
This is a summary of what features appeared in which versions of Python. Items with a star were introduced with a __future__ import.
3.11 (beta): due October 3, 2022
- 10—60% faster than 3.10
- exact expression error locations
- exception groups and notes
- typing: Self, LiteralString
Full list of 3.11 changes so far.
3.10: October 4, 2021
- structural pattern matching (PEP 634)
- better error messages
- parenthesized context managers
- union types as X|Y
3.9: October 5, 2020
- dict union operators
- type hinting generics in standard collections
- relaxed decorator syntax
- str.removeprefix and str.removesuffix
3.8: October 14, 2019
- assignment expressions (walrus operator := )
- f-string “=” specifier
- positional-only parameters
3.7: June 27, 2018
- postponed evaluation of type annotations (PEP 563)
- async and await are keywords
- dataclasses
- dict order is guaranteed
3.6: December 23, 2016
- f-strings
- kwargs and class attributes order is preserved
- dicts happen to be (but are not guaranteed to be) ordered
- underscores in numeric literals
- variable annotations
- secrets module in stdlib
3.5: September 13, 2015
- async and await syntax
- matrix multiplication operator @
- more unpacking generalizations
- The typing module for type hints
- subprocess.run()
- os.scandir()
3.4: March 16, 2014
- pip is always available, via ensurepip
- asyncio (provisional API)
- enum
- Other stdlib modules: statistics, pathlib, and tracemalloc
3.3: September 29th, 2012
- yield from
- u”” literals are back
- unittest.mock
- hash randomization
- New flexible string representation
- venv module
- more of import implemented in Python
3.2: February 20th, 2011
- argparse
- concurrent.futures
- __pycache__ directories
- hasattr doesn’t swallow all exceptions
3.1: June 27th, 2009
- OrderedDict and Counter classes
- __main__.py
3.0: December 3rd, 2008
- strings are now unicode, no u”” literals
- print as a function
- iterators instead of lists: range, .keys, .items, .values, zip, map, filter
- nonlocal
- function annotations
- lots of things moved in the standard library
2.7: July 3rd, 2010
- Set literals syntax
- Dictionary and set comprehensions
- OrderedDict and Counter classes
- argparse
- .format can use bare {} placeholders
2.6: October 1st, 2008
- The multiprocessing package
- str.format()
- 3.0 compatibility: print function *, byte literals, io library
- “except” with “as” keyword
- Abstract base classes
- Class decorators
- The fractions module
2.5: September 19th, 2006
- The “with” statement *
- Conditional expressions
- The functools module
- Unified try/except/finally
- Value passed into generators
- defaultdict
- any(), all(), min(key=) and max(key=)
2.4: November 30th, 2004
- Native set datatype
- Generator expressions
- Function decorators
- string.Template
- reversed()
- The subprocess and decimal modules
2.3: July 29th, 2003
- Set datatype module
- Boolean datatype
- Importing from zip files
- enumerate
- The logging and csv packages
- Extended list slicing
2.2: December 21st, 2001
- New-style classes
- Iterators
- Generators *
- // integer division
- Dividing ints can produce floats *
2.1: April 17th, 2001
- Nested scopes *
- “from __future__”
- Rich comparisons
- Weak references
from Hacker News https://ift.tt/4Xa8nQT
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.