Monday, May 23, 2022

What’s in Which Python

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

Full list of 3.10 changes.

3.9: October 5, 2020

  • dict union operators
  • type hinting generics in standard collections
  • relaxed decorator syntax
  • str.removeprefix and str.removesuffix

Full list of 3.9 changes.

3.8: October 14, 2019

  • assignment expressions (walrus operator := )
  • f-string “=” specifier
  • positional-only parameters

Full list of 3.8 changes.

3.7: June 27, 2018

  • postponed evaluation of type annotations (PEP 563)
  • async and await are keywords
  • dataclasses
  • dict order is guaranteed

Full list of 3.7 changes.

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

Full list of 3.6 changes.

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()

Full list of 3.5 changes.

3.4: March 16, 2014

  • pip is always available, via ensurepip
  • asyncio (provisional API)
  • enum
  • Other stdlib modules: statistics, pathlib, and tracemalloc

Full list of 3.4 changes.

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

Full list of 3.3 changes.

3.2: February 20th, 2011

  • argparse
  • concurrent.futures
  • __pycache__ directories
  • hasattr doesn’t swallow all exceptions

Full list of 3.2 changes.

3.1: June 27th, 2009

  • OrderedDict and Counter classes
  • __main__.py

Full list of 3.1 changes.

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

Full list of 3.0 changes.

2.7: July 3rd, 2010

  • Set literals syntax
  • Dictionary and set comprehensions
  • OrderedDict and Counter classes
  • argparse
  • .format can use bare {} placeholders

Full list of 2.7 changes.

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

Full list of 2.6 changes.

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=)

Full list of 2.5 changes.

2.4: November 30th, 2004

  • Native set datatype
  • Generator expressions
  • Function decorators
  • string.Template
  • reversed()
  • The subprocess and decimal modules

Full list of 2.4 changes.

2.3: July 29th, 2003

  • Set datatype module
  • Boolean datatype
  • Importing from zip files
  • enumerate
  • The logging and csv packages
  • Extended list slicing

Full list of 2.3 changes.

2.2: December 21st, 2001

  • New-style classes
  • Iterators
  • Generators *
  • // integer division
  • Dividing ints can produce floats *

Full list of 2.2 changes.

2.1: April 17th, 2001

  • Nested scopes *
  • “from __future__”
  • Rich comparisons
  • Weak references

Full list of 2.1 changes.



from Hacker News https://ift.tt/4Xa8nQT

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.