The open-source Python programming language continues to increase its popularity day by day because of its modularity and steady pace of innovation. It seems to stay as one of the most popular programming languages and continues to be the choice of new developers, essentially with the updates in the latest 3.8.0 release.
Python 3.8.0 comes with new features
The latest 3.8.0 release of Python that became publicly available on October 14 comes with new features and optimizations. One of the most significant in the list of those new features is the addition of assignment expressions to the language, known as the Walrus Operator. This feature allows assigning and returning a value in the same expression. According to the Python 3.8.0 release,
“There is new syntax: = that assigns values to variables as part of a larger expression. It is affectionately known as “the walrus operator” due to its resemblance to the eyes and tusks of a walrus.”
Positional-Only Arguments
The Python 3.8.0 release note states:
There is a new function parameter syntax / to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments. This is the same notation shown by help() for C functions annotated with Larry Hastings’ Argument Clinic tool.
This basically means refactoring your functions and changing the name of your parameters. On the security side, there are also some improvements like Audit Hooks (PEP-578), which can be used to provide runtime control for code.
New features of the 3.8 series, compared to 3.7
- PEP 572, Assignment expressions
- PEP 570, Positional-only arguments
- PEP 587, Python Initialization Configuration (improved embedding)
- PEP 590, Vectorcall: a fast calling protocol for CPython
- PEP 578, Runtime audit hooks
- PEP 574, Pickle protocol 5 with out-of-band data
- Typing-related: PEP 591 (Final qualifier), PEP 586 (Literal types), and PEP 589 (TypedDict)
- Parallel filesystem cache for compiled bytecode
- Debug builds share ABI as release builds
- f-strings support a handy = specifier for debugging
- continue is now legal in finally: blocks
- on Windows, the default asyncio event loop is now ProactorEventLoop
- on macOS, the spawn start method is now used by default in multiprocessing
- Multiprocessing can now use shared memory segments to avoid pickling costs between processes
- typed_ast is merged back to CPython
- LOAD_GLOBAL is now 40% faster
- Pickle now uses Protocol 4 by default, improving performance