Python Will be Dead in 2021?

A review of the final version of Python 3.9

x = {"dict1": "x1", "dict2": "x2"}
y = {"dict2": "y1", "dict3": "y2"}
# merge dict
x | y
{'dict1': 'x1', 'dict2': 'y1', 'dict3': 'y2'}
x = {"dict1": "x1", "dict2": "x2"}
y = {"dict2": "y1", "dict3": "y2"}
# update dict x
x |= y
{'dict1': 'x1', 'dict2': 'y1', 'dict3': 'y2'}
2020-10-31 12:00:00-07:00
string = 'Hello World'# remove prefix
string.removeprefix('Hello')
' World'
string = 'Hello World'# remove prefix
string.removesuffix('World')
'Hello '

References

Python Programmer || Data Scientist || Bayesian Astronomer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store