filmov
tv
Python Releases: Python 3.9.0a6 New Features and Changes, Released on 28th April, 2020

Показать описание
Python Releases: Python 3.9.0a6 released on 28th April, 2020, New Features and Changes
Python 3.9 is still in development. In this video we will talk about Python 3.9.0a6 which was released on 28th April, 2020 and is an early developer preview of Python 3.9.
This release, 3.9.0a6 is the last out of six planned alpha releases by python developers. Alpha releases are intended to make it easier to test the current state of new features and bug fixes and to test the release process. During the alpha phase, features may be added up until the start of the beta phase and, if necessary, may be modified or deleted up until the release candidate phase. Please keep in mind that this 3.9.0a6 is a preview release and its use is not recommended for production environments.
Let's see what are the major new features of the 3.9 series as compared to 3.8.
Many new features for Python 3.9 are still being planned and written. Some of them are:
Adding the merge operator the pipe operator (|) and update pipe equals to (|=) operators to the built-in dict class
So Dictionary Union - Merge & Update Operators have been added in dict as per PEP 584
What it means is that the dictionary union will return a new dictionary where the left operand is merged with the right operand. Both the operands must be a dictionary. If a key appears in both the dictionaries, then the last value from the dictionary on the right hand side will be used. so e.g.
We have a dictionary
x = {'spam': 1, 'eggs': 2, 'cheese': 3}
and another
y = {'cheese': 'cheddar', 'aardvark': 'Ethel'}
then
print(x | y)
on running will give a new dictionary with the second dictionary y's key value pairs merged with the first dictionary x like this as the output
Now, let's try
print(y | x)
and we see on running a new dictionary with the second dictionary x's key value pairs merged with the first dictionary y here
Also, the augmented assignment version operates in-place now. So if we do
x |= y
print(x)
then we see the dictionary x merged with the key value pairs of dictionary y.
Another feature added to python 3.9.0a6 is the addition of two string methods
removeprefix() and removesuffix() as per PEP 616
These methods have been added to easily remove an unneeded prefix or a suffix from a string (respectively) from a string, if present.
The removeprefix method removes a desired prefix from a string and returns a new string.
Say we have a string
p = 'unhappy'
print(t)
print(p)
So, we see that the prefix 'un' has been removed and returned as a new string where as the original string remains as it is.
Similarly, the removesuffix method removes a desired suffix from a string and returns a new string.
So, e.g. if we have a string
p = 'python3.9.0a6'
print(t)
print(p)
The output shows us the new string with the removed string and the original string remains the same.
Among other new features and changes implemented till python 3.9.0a6 are:
Type Hinting Generics In Standard Collections as per PEP 585
Flexible function and variable annotations as per PEP 593
Python adopts a stable annual release frequency as per PEP 602
New PEG parser for CPython as per PEP 617
Unicode support updated to version 13.0.0
A number of Python builtins are now sped up using PEP 590 vectorcall
A number of Python modules now use multiphase initialization as per PEP 489
A number of standard library modules are now using the stable ABI as per PEP 384.
#3.9 #3.9.0 #3.9.0a6 #3.9.0b1 #new #features #releases #latest #changes #28 #April #Dictionary #Union #Merge #Update #Operators #PEP584 #string #methods #removeprefix #removesuffix #PEP616 #download #install #October #2020 #Alpha #Beta #release #candidate #Python #Gurgaon #Coding #Classes #Gurugram #Programming #Beginner #Tutorials #Python3 #Python3.9 #Python3.9.0 #Python3.8
Python 3.9 is still in development. In this video we will talk about Python 3.9.0a6 which was released on 28th April, 2020 and is an early developer preview of Python 3.9.
This release, 3.9.0a6 is the last out of six planned alpha releases by python developers. Alpha releases are intended to make it easier to test the current state of new features and bug fixes and to test the release process. During the alpha phase, features may be added up until the start of the beta phase and, if necessary, may be modified or deleted up until the release candidate phase. Please keep in mind that this 3.9.0a6 is a preview release and its use is not recommended for production environments.
Let's see what are the major new features of the 3.9 series as compared to 3.8.
Many new features for Python 3.9 are still being planned and written. Some of them are:
Adding the merge operator the pipe operator (|) and update pipe equals to (|=) operators to the built-in dict class
So Dictionary Union - Merge & Update Operators have been added in dict as per PEP 584
What it means is that the dictionary union will return a new dictionary where the left operand is merged with the right operand. Both the operands must be a dictionary. If a key appears in both the dictionaries, then the last value from the dictionary on the right hand side will be used. so e.g.
We have a dictionary
x = {'spam': 1, 'eggs': 2, 'cheese': 3}
and another
y = {'cheese': 'cheddar', 'aardvark': 'Ethel'}
then
print(x | y)
on running will give a new dictionary with the second dictionary y's key value pairs merged with the first dictionary x like this as the output
Now, let's try
print(y | x)
and we see on running a new dictionary with the second dictionary x's key value pairs merged with the first dictionary y here
Also, the augmented assignment version operates in-place now. So if we do
x |= y
print(x)
then we see the dictionary x merged with the key value pairs of dictionary y.
Another feature added to python 3.9.0a6 is the addition of two string methods
removeprefix() and removesuffix() as per PEP 616
These methods have been added to easily remove an unneeded prefix or a suffix from a string (respectively) from a string, if present.
The removeprefix method removes a desired prefix from a string and returns a new string.
Say we have a string
p = 'unhappy'
print(t)
print(p)
So, we see that the prefix 'un' has been removed and returned as a new string where as the original string remains as it is.
Similarly, the removesuffix method removes a desired suffix from a string and returns a new string.
So, e.g. if we have a string
p = 'python3.9.0a6'
print(t)
print(p)
The output shows us the new string with the removed string and the original string remains the same.
Among other new features and changes implemented till python 3.9.0a6 are:
Type Hinting Generics In Standard Collections as per PEP 585
Flexible function and variable annotations as per PEP 593
Python adopts a stable annual release frequency as per PEP 602
New PEG parser for CPython as per PEP 617
Unicode support updated to version 13.0.0
A number of Python builtins are now sped up using PEP 590 vectorcall
A number of Python modules now use multiphase initialization as per PEP 489
A number of standard library modules are now using the stable ABI as per PEP 384.
#3.9 #3.9.0 #3.9.0a6 #3.9.0b1 #new #features #releases #latest #changes #28 #April #Dictionary #Union #Merge #Update #Operators #PEP584 #string #methods #removeprefix #removesuffix #PEP616 #download #install #October #2020 #Alpha #Beta #release #candidate #Python #Gurgaon #Coding #Classes #Gurugram #Programming #Beginner #Tutorials #Python3 #Python3.9 #Python3.9.0 #Python3.8