Jul-09-2020, 07:49 AM
Feature for Python 3.10: https://www.python.org/dev/peps/pep-0622/
Quote:Abstract
This PEP proposes to add a pattern matching statement to Python, inspired by similar syntax found in Scala and many other languages.
The pattern syntax builds on Python’s existing syntax for sequence unpacking (e.g., a, b = value), but is wrapped in a match statement which compares its subject to several different “shapes” until one is found that fits. In addition to specifying the shape of a sequence to be unpacked, patterns can also specify the shape to be a mapping with specific keys, an instance of a given class with (optionally) specific attributes, a specific value, or a wildcard. Patterns can be composed in several ways.
....
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!