반응형

What’s New in Python 3.13

https://medium.com/@rdhankhar899/whats-new-in-python-3-13-45516e6568a8

 

What’s New in Python 3.13

This article explains the new features in Python 3.13, compared to 3.12. Python 3.13 was released on October 7, 2024, marking a significant…

medium.com

https://docs.python.org/ko/3.13/whatsnew/3.13.html#what-s-new-in-python-3-13

 

What’s New In Python 3.13

Editors, Adam Turner and Thomas Wouters,. This article explains the new features in Python 3.13, compared to 3.12. Python 3.13 was released on October 7, 2024. For full details, see the changelog. ...

docs.python.org

This article explains the new features in Python 3.13, compared to 3.12. Python 3.13 was released on October 7, 2024, marking a significant advancement for the language. Many of the most impactful changes occur behind the scenes, so they may take time to notice.

Python 3.13 is setting the stage for future enhancements, particularly in terms of performance improvements. For full details, see the changelog.

Python 3.13 is the latest stable release of the Python programming language, with a mix of changes to the language, the implementation and the standard library. The biggest changes include a new interactive interpreter, experimental support for running in a free-threaded mode (PEP 703), and a Just-In-Time compiler (PEP 744).

Error messages continue to improve, with tracebacks now highlighted in color by default. The locals() builtin now has defined semantics for changing returning mapping, and type parameters now support values.

The library changes contain removal of deprecated APIs and modules, as well as the usual improvements in user-friendliness and correctness. Several legacy standard library modules have now been removed following their deprecation in Python 3.11 (PEP 594).

Here is a list of major features and improved modules.

· Improved REPL

· Free Threading Cpython

· An Experimental just-in-time (JIT)

· Improved Error Messages

· Copy’s Replace

· Support for Mobile Platforms

Improved REPL

Python now uses a new interactive shell by default, based on code from the PyPy project. When the user starts the REPL from an interactive terminal, the following new features are now supported:

  • Multiline editing with history preservation.
  • Direct support for REPL-specific commands like help, exit, and quit, without the need to call them as functions.
  • Prompts and tracebacks with color enabled by default.
  • Interactive help browsing using F1 with a separate command history.
  • History browsing using F2 that skips output as well as the >>> and  prompts.
  • “Paste mode” with F3 that makes pasting larger blocks of code easier (press F3 again to return to the regular prompt).

Free Threading Cpython

CPython now has experimental support for running in a free-threaded mode, with the global interpreter lock (GIL) disabled. This is an experimental feature and therefore is not enabled by default. The free-threaded mode requires a different executable, usually called python3.13t or python3.13t.exe. Pre-built binaries marked as free-threaded can be installed as part of the official Windows and macOS installers, or CPython can be built from source with the — disable-gil option.

An Experimental just-in-time (JIT)

When CPython is configured and built using the — enable-experimental-jit option, a just-in-time (JIT) compiler is added which may speed up some Python programs. On Windows, use PCbuild/build.bat — experimental-jit to enable the JIT or — experimental-jit-interpreter to enable the Tier 2 interpreter. Build requirements and further supporting information are contained at Tools/jit/README.md.

Improved Error Messages

The interpreter now uses color by default when displaying tracebacks in the terminal. This feature can be controlled via the new PYTHON_COLORS environment variable as well as the canonical NO_COLOR and FORCE_COLOR environment variables. (Contributed by Pablo Galindo Salgado in gh-112730.)

The error message now tries to suggest the correct keyword argument when an incorrect keyword argument is passed to a function.

# Incorrect usage of the built-in sorted() function
sorted([3, 1, 2], reversed=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    sorted([3, 1, 2], reversed=True)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: sorted() got an unexpected keyword argument 'reversed'. Did you mean 'reverse'?

Copy’s Replace

The new replace() function and the replace protocol make creating modified copies of objects much simpler. This is especially useful when working with immutable objects. The following types support the replace() function and implement the replace protocol:

Any user-defined class can also support copy.replace() by defining the __replace__() method. (Contributed by Serhiy Storchaka in gh-108751.)

Support for Mobile Platforms

PEP 730: iOS is now a PEP 11 supported platform, with the arm64-apple-ios and arm64-apple-ios-simulator targets at tier 3 (iPhone and iPad devices released after 2013 and the Xcode iOS simulator running on Apple silicon hardware, respectively). x86_64-apple-ios-simulator (the Xcode iOS simulator running on older x86_64 hardware) is not a tier 3 supported platform, but will have best-effort support. (PEP written and implementation contributed by Russell Keith-Magee in gh-114099.)

PEP 738: Android is now a PEP 11 supported platform, with the aarch64-linux-android and x86_64-linux-android targets at tier 3. The 32-bit targets arm-linux-androideabi and i686-linux-android are not tier 3 supported platforms, but will have best-effort support. (PEP written and implementation contributed by Malcolm Smith in gh-116622.)

반응형

+ Recent posts