Awesome Pattern Matching Versions Save

Pattern Matching for Python 3.7+ in a simple, yet powerful, extensible manner.

0.24.4

1 year ago
  • bugfix release

0.24.3

2 years ago
  • Some is now properly Hashable
  • Documented Parameters
  • Deprecated Arguments

0.24.2

2 years ago
  • Fixes an issue with the _ (underscore) special key pattern when matching dictionaries

0.24.1

2 years ago
  • Fixes an issue with Some in Some

0.24.0

2 years ago
  • Adds case guards (when= and guarded)
  • Adds Remainder
  • Adds Object

0.23.0

2 years ago
  • Fixes #8 which introduces a new Feature, see description in pull #9

This allows Some(*) to match subsequences.

Previously Some(...) would only match individiual items, i.e. the pattern [0, Some(1), 2] would match the value [0, 1, 1, 1, 2]. Compared with a regex on strings this would be like 01*2 but the repetition here could not be applied to subsequences 0(12)*3. This pull request introduces the ability for Some(*) to take multiple patterns which it then tries to match as a sequence within: [0, Some(1, 2), 3] would now match the value [0, 1, 2, 1, 2, 3]. This could not be expressed before.

Note that the new syntax is different from Some([1, 2]) as this would match items which are themselves lists, i.e. [0, [1, 2], [1, 2], 3].

0.22.0

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago
  • track python 3.10 development, compatible with alpha7

0.20.0

3 years ago
  • Added an .explain() which can help with understanding why a match did not succeed