Skip to content

Instantly share code, notes, and snippets.

@fillest
Last active January 3, 2026 13:24
Show Gist options
  • Select an option

  • Save fillest/dce93a03f2e5a865ec5457abbe5ce297 to your computer and use it in GitHub Desktop.

Select an option

Save fillest/dce93a03f2e5a865ec5457abbe5ce297 to your computer and use it in GitHub Desktop.

grouped by versions in an ascending order.
most important is marked with bold.


(https://docs.python.org/3/whatsnew/3.0.html)

  • binary data and Unicode
    Python 3.0 uses the concepts of text and (binary) data.
    All text is Unicode ("...")
    b"..." literals for binary data.
    any attempt to mix text and data in Python 3.0 raises TypeError
    >The rules for translating a Unicode string into a sequence of bytes are called a character encoding, or just an encoding.
    str.encode() to go from str to bytes, bytes.decode() to go from bytes to str
    basestring was removed. Use str instead -- again, bytes are separate
    Files opened as text files (still the default mode for open()) always use an encoding to map between strings (in memory) and bytes (on disk). Binary files (opened with a b in the mode argument) always use bytes in memory.
    The default source encoding is now UTF-8.
    Python’s re module defaults to the re.UNICODE flag rather than re.ASCII. This means, for instance, that r"\w" matches Unicode word characters, not just ASCII letters.
  • Exception chaining raise [expr [from expr]]
  • print()
  • dict methods .keys(), .items() and .values() return “views” instead of lists
  • removed dict.iter*() methods
  • map() and filter() return iterators
  • range() now behaves like xrange() used to behave
  • 1/2 returns a float. Use 1//2 to get the truncating behavior.
  • Octal literals 0720 -> 0o720
  • Named parameters occurring after *args in the parameter list must be specified using keyword syntax in the call. You can also use a bare * in the parameter list to indicate that you don’t accept a variable-length argument list, but you do have keyword-only arguments.
  • Extended Iterable Unpacking e.g. (a, *rest, b) = range(5)
  • Set literals, e.g. {1, 2}, Set comprehensions
  • Tuple parameter unpacking removed. You can no longer write def foo(a, (b, c)): .... Use def foo(a, b_c): b, c = b_c instead.
  • Classic classes are gone.
  • The io module is now the standard way of doing file I/O. The built-in open() function is now an alias for io.open()
  • In Python 3.0, the accelerated versions are considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python version.
  • You can now invoke super() without arguments
  • (less important)
    • BaseException
    • The StringIO module has been turned into a class in the io module.
    • The only acceptable syntax for relative imports is from .[module] import name. All import forms not starting with . are interpreted as absolute imports. (PEP 328)
    • Dictionary comprehensions (already in 2.7)
    • new convention for specifying a metaclass
    • Using nonlocal x you can now assign directly to a variable in an outer (but non-global) scope.
    • long renamed to int

(https://docs.python.org/3/whatsnew/3.1.html)

  • (less important)
    • Directories and zip archives containing a __main__.py file can now be executed directly by passing their name to the interpreter.
    • The runpy module which supports the -m command line switch now supports the execution of packages by looking for and executing a __main__ submodule when a package name is supplied.

(https://docs.python.org/3/whatsnew/3.2.html)

(https://docs.python.org/3/whatsnew/3.3.html)

  • yield from https://stackoverflow.com/q/9708902/1183239
  • venv
  • OSError subclasses e.g. FileNotFoundError, ConnectionRefusedError
  • datetime.timestamp()
  • time.monotonic()
  • clock_gettime(), perf_counter()
  • (less important)
    • signal.pthread_kill If signalnum is 0, then no signal is sent, but error checking is still performed; this can be used to check if the target thread is still running.

(https://docs.python.org/3/whatsnew/3.4.html)

  • asyncio
  • pathlib
  • tracemalloc
  • (less important)
    • enum
    • statistics
    • gc.get_stats()
    • multiprocessing now has an option to avoid using os.fork on Unix
    • pickle protocol 4.
    • regex.fullmatch()
    • main_thread()
    • Customization of CPython Memory Allocators

(https://docs.python.org/3/whatsnew/3.5.html)

  • Type Hints
  • additional unpacking generalizations
    d3 = {**d1, **d2}
    print(*[1], *[2], 3, *[4, 5])
    fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})
    [*range(4), 4]
    {'x': 1, **{'y': 2}}
  • subprocess.run()
  • from __future__ import generator_stop
  • Circular imports involving relative imports are now supported

(https://docs.python.org/3/whatsnew/3.6.html)

  • multiprocessing.shared_memory
  • Assignment expressions (the “walrus operator”, :=) to assign values to variables as part of an expression.
  • (less important)
    • Positional-only parameters
    • Parallel filesystem cache for compiled bytecode files
    • f'{cos(radians(theta))=:.3f}' expands to e.g. 'cos(radians(theta))=0.866'
    • Runtime Audit Hooks
    • Pickle protocol 5
    • Dict and dictviews are now iterable in reversed insertion order using reversed()
    • importlib.metadata module provides (provisional) support for reading metadata from third-party packages. For example, it can extract an installed package’s version number, list of entry points
    • sys.unraisablehook()
    • threading.excepthook()
  • Merge (|) and update (|=) operators have been added to the built-in dict class.
  • str.removeprefix(prefix) and str.removesuffix(suffix). Corresponding bytes, bytearray, and collections.UserString methods have also been added.
  • Type Hinting Generics in Standard Collections
  • zoneinfo, tzdata change
  • stdlib tomllib: For parsing TOML
  • >the interpreter will now point to the exact expression that caused the error
  • asyncio.Runner
  • good typing improvements https://docs.python.org/3.11/whatsnew/3.11.html#new-features-related-to-type-hints
  • Exception Groups and except* https://peps.python.org/pep-0654/
  • Python 3.11 is between 10-60% faster than Python 3.10.

  • The add_note() method is added to BaseException. It can be used to enrich exceptions with context information that is not available at the time when the exception is raised.
  • Starred unpacking expressions can now be used in for statements.

  • hashlib.file_digest()
  • logging.getLevelNamesMapping()
  • operator.call
  • pathlib glob() and rglob() return only directories if pattern ends with a pathname components separator
  • On Unix, time.sleep() now uses the clock_nanosleep() or nanosleep() function, if available
  • significantly improved typing
  • improved f-strings
  • per-interpreter GIL >currently only available through the C-API, though a Python API is anticipated for 3.13
  • new API for profilers, debuggers, and other tools ... you only pay for what you use, providing support for near-zero overhead debuggers and coverage tools
  • buffer protocol accessible in Python
  • Improved Error Messages
  • CPython support for the Linux perf profiler
  • itertools.batched()
  • sqlite3 module can be invoked as a script, using the interpreter’s -m switch, in order to provide a simple SQLite shell
  • uuid module can be executed as a script from the command line
  • datetime: datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC.
  • stop installing setuptools in environments created by venv
  • Replace the builtin hashlib implementations of SHA1, SHA3, SHA2-384, SHA2-512, and MD5 with formally verified code from the HACL* project. These builtin implementations remain as fallbacks that are only used when OpenSSL does not provide them.
  • new improved interactive shell by default
  • Add Queue.shutdown and ShutDown to manage queue termination.
  • asyncio.as_completed() now returns an object that is both an asynchronous iterator and a plain iterator of awaitables
  • os.process_cpu_count() - number of logical CPUs usable by the calling thread of the current process
  • The location of a .python_history file can be changed via the new PYTHON_HISTORY environment variable
  • typing.TypeIs provides more intuitive type narrowing behavior, as an alternative to typing.TypeGuard.
  • warnings.deprecated() decorator provides a way to communicate deprecations to a static type checker and to warn on usage of deprecated classes and functions.
  • The random module can be executed from the command line
  • experimental support for running in a free-threaded mode, with the global interpreter lock (GIL) disabled (not enabled by default)
  • experimental just-in-time (JIT) compiler
  • Type parameters (typing.TypeVar, typing.ParamSpec, and typing.TypeVarTuple) now support defaults.
  • typing.ReadOnly can be used to mark an item of a typing.TypedDict as read-only for type checkers.
  • __static_attributes__ (names of attributes of this class which are assigned through self.X from any function in its body)
  • argparse module now supports deprecating command-line options, positional arguments, and subcommands.
  • base64.z85encode()
  • concurrent.futures, multiprocessing - The default number of worker threads and processes is now selected using os.process_cpu_count() instead of os.cpu_count()
  • glob.translate(), a function to convert a path specification with shell-style wildcards to a regular expression
  • PurePath.full_match() for matching paths with shell-style wildcards, including the recursive wildcard “**”
  • Add the exc_type_str attribute to TracebackException, which holds a string display of the exc_type
  • Improved error messages
  • Add a low level interface to Linux’s timer file descriptors
  • Defined mutation semantics for locals()
  • CPython now bundles the mimalloc library by default. (-- did they switch globally?)
  • Add support for the perf profiler working without frame pointers
  • improved support for iOS, Android, wasm32-wasi
  • Deferred evaluation of annotations
  • zero-overhead debugging interface that allows debuggers and profilers to safely attach to running Python processes without stopping or restarting them
  • Asyncio introspection capabilities
  • The pdb module now supports remote attaching to a running Python process using a new -p PID command-line option
  • Add the strptime() method to the datetime.date and datetime.time
  • The default interactive shell now highlights Python syntax. The default interactive shell now supports import auto-completion
  • Zstandard support in the standard library
  • Template string literals
  • Add support for UUID versions 6, 7, and 8
  • Set the default protocol version on the pickle module to 5
  • Multiple interpreters in the standard library; concurrent.interpreters (multi-core parallelism); concurrent.futures.InterpreterPoolExecutor
  • A new type of interpreter (uses tail calls between small C functions that implement individual Python opcodes), 3-5% faster (opt-in)
  • Free-threaded mode improvements
  • The free-threaded build of Python is now supported and no longer experimental. This is the start of phase II where free-threaded Python is officially supported but still optional
  • Improved error messages
  • float.from_number(), Decimal.from_number()
  • The memoryview type now supports subscription, making it a generic type.
  • super objects are now copyable and pickleable
  • The except and except* expressions now allow brackets to be omitted when there are multiple exception types and the as clause is not used
  • The cycle garbage collector is now incremental
  • compression package
  • On Unix platforms other than macOS, ‘forkserver’ is now the the default start method for ProcessPoolExecutor (replacing ‘fork’); also for multiprocessing
  • ProcessPoolExecutor terminate_workers() and kill_workers()
  • Executor.map buffersize
  • python -m http.server https
  • python -m json - is now preferred to python -m json.tool, which is soft deprecated
  • Add the interrupt() to multiprocessing.Process objects, which terminates the child process by sending SIGINT.
  • reload_environ()
  • readinto()
  • Add methods to pathlib.Path to recursively copy or move files and directories
  • pathlib - Add the info attribute, which stores an object implementing the new pathlib.types.PathInfo protocol
  • The types.UnionType and typing.Union types are now aliases for each other, meaning that both old-style unions (created with Union[int, str]) and new-style unions (int | str) now create instances of the same runtime type
  • Allow generating multiple UUIDs simultaneously on the command-line via python -m uuid --count
  • asyncio.get_event_loop() now raises a RuntimeError if there is no current event loop, and no longer implicitly creates an event loop (If you need to run something in an event loop, then run some blocking code around it, use asyncio.Runner)
  • Emscripten is now an officially supported platform at tier 3
  • Official Android binary releases are now provided on python.org
  • Installations of Python now contain a new file, build-details.json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment