This is a HIGHLY subjective list of new features that I personally find useful when porting programs and libraries to newer versions of Python.
Let me say that again: this list is HIGHLY subjective. Pinch of salt, YMMV, etc.
async and await are reserved keywordsdict is ordered (insertion order)asyncio.run() and asyncio.create_task(), as well as
a slew of othersdatetime.fromisoformat()functools.singledispatch()hmac.digest()TextIOWrapper.reconfigure()socket.close()subprocess.run(capture_output=True){expr=...} in f-strings\N{name} in regular expressionsfunctools.lru_cache without parenthesesfunctools.cached_property()functools.singledispatchmethod()Path.link_to(), but see Path.hardlink_to() in 3.10shlex.join()Final, Literal, Protocol, and TypedDicttyping.get_origin() and typing.get_args()dict (dict_a | dict_b, dict_a |= dict_b)dict, list, etc. can now be used as typing genericsstr.removeprefix() and str.removesuffix()__file__ is now an absolute pathPidfdChildWatcherCallable, Generator, Iterable, Iterator, etc.os.pidfd_open() for Linux 5.3+os.waitstatus_to_exitcode()Path.readlink()random.randbytes()socket.send_fds() and socket.recv_fds()Annotated and typing.get_type_hints(include_extras=True)X | YTypeAlias and ParamSpecaiter() and anext()kw_only=True)os.eventfd() and os.splice()Path.hardlink_to() and deprecate Path.link_to()socket.timeout is now a TimeoutErrorfor statementsexc_type and exc_traceback dropped from exc_infostart_tls()timeout()chdir()UTCStrEnum! ReprEnum!singledispatch() understands unions nowcall()time.sleep() with nanosecond resolutionassert_never(), assert_type(), reveal_type()dataclass_transform?LiteralStringSelf! Self! Self!TypeVarTuple?TypedDict: Required/NotRequiredAny can now be subclassed?eager_task_factory() is all about, maybe pass it to
run() as a task factoryConfigParser.readfp() is removed, use readfile() insteadutcnow() and utcfromtimestamp() are deprecated; use now() and
fromtimestamp() passing tz=datetime.UTC insteadcached_property() no longer locks, let's hope we don't use it anywayitertools.batched()walk()relative_to(..., walk_up)case_sensitive for glob() and friendsmake_archive(..., root_dir)last_exc for debugging, e.g. in the REPLNamedTemporaryFile(..., delete_on_close=True)loop.create_unix_server() automatically removes the socketreplace()IPv4Address.ipv6_mappedprocess_cpu_count()Path.from_uri()PurePath.full_match()PatternError (renamed from re.error)exc_type is deprecatedget_protocol_members()is_protocol()