Python - new language features
Python has some interesting new features which improve code quality a lot. Here are my favourites sorted by version. Note that Python 3.8 hasn't been released yet. However, the feature assignment expressions has already been decided upon and its decision process has let Guido van Rossum, the founder of Python, to resign.
Python 3.8
- Assignment Expressions:
if (a := method()):
Python 3.7
breakpoint()
works as shortcut forimport pdb; pdb.set_trace()
Python 3.6
- String formatting:
f"Hello {var}."
- secrets: secure random numbers
- Type annotations for variables
- Special type for file system paths:
os.PathLike
instead ofstr