Python has many great features – convenience, a wide range of powerful libraries, a useful user community – but some elements are still missing. Some features found in other languages ​​would make certain tasks easier, but they won’t be coming to Python any time soon.

Here are four commonly searched language features that are not currently on Python maps. At least two of them will never happen, while the others are at best in years to come. We will look at what blocks these features or what it takes to include them in a future version of Python.

No: A statically entered, compiled version of Python

Some developers dream of Python, which uses static input to compile into its own machine code. After all, flexible writing is the source of much of Python’s slowdown, and static writing would put an end to that. Static writing also gives programmers strong guarantees about what to expect from their code. So what’s the problem?

Although Python has type hints, they are designed to make the language more susceptible to static analysis during editing through lining tools. Only third party projects (e.g. pydantic) use hints for type at runtime. The Python runtime itself does not use type hints.

One of the explicit objectives in PEP 484, Proposal to improve Python type hint, tip tips were to be optional forever. “Python will remain a dynamically introduced language, and authors are reluctant to ever make type advice mandatory, even by convention.”

Developers who really want a static version of Python can turn to Cython or mypycbut even these projects come with compromises. In the case of Cython, the biggest increase in performance comes from the use of pure C types and structures and a reduction in the use of Python runtime. Simply put, it’s hard to get Python to compile faster without sacrificing its dynamics. It is much easier to take the parts that do not need dynamics, separate them and speed them up.

Copyright © 2022 IDG Communications, Inc.

https://www.infoworld.com/article/3653253/4-useful-features-you-wont-be-seeing-in-python.html#tk.rss_all

Previous article15-year mortgage rates for May 2022
Next articleSafe ways to hide nude photos