Commit Graph

12 Commits

Author SHA1 Message Date
Mark Shannon 4134c46262
Simplifications of PEP 653: (#1919)
* Make 0 the defualt for __match_class__ and drop ability to not match class patterns

* Use equality not bitwise ands to check for matches

* Add to rejected and deferred sections, explaining the above
2021-04-12 12:17:50 +01:00
Mark Shannon c029c02e36
PEP 653: Fix example. Use get(key, sentinel) instead of __getitem__(key) for mappings. (#1902) 2021-03-30 23:30:43 +01:00
Mark Shannon 0a0e7a3045
PEP 653: Split __match_kind__ into __match_container__ and __match_class__ (#1901) 2021-03-30 11:47:14 +01:00
Mark Shannon 59b39a6dd0
PEP 653: Delete out-of-date note and correct tests in mapping pattern translations. (#1895) 2021-03-27 18:17:04 +00:00
Mark Shannon 3686181865
PEP 653: Remove MATCH_POSITIONAL and make semantics for MATCH_DEFAULT near identical to PEP 634. (#1893)
* Use class in pattern for matching, rather than subject.

* Remove temporary dict when matching mapping patterns.

* Remove MATCH_POSITIONAL.
2021-03-27 12:14:48 +00:00
CAM Gerlach e6fb0d8ca6
Validate PEP created dates and update linters (#1886)
* Check created date exists & matches format, and fix non-conforming

* Automatically fix mixed EoLs on checkin and in one PEP

* Add rst-directive-colons check, fix issue it found and refine regex
2021-03-22 12:29:08 -07:00
Mark Shannon 54a16d60ef
Don't special case named tuples. The default behavior is fine. (#1874) 2021-03-16 11:15:21 +00:00
Mark Shannon 3cc86339d2
PEP 653: Change semantics to be closer to PEP 634, while keeping the important features of PEP 653. (#1868)
* Change name of `MATCH_CLASS` to `MATCH_POSITIONAL`.
* Drop `__attributes__` and use `__match_args__` instead.
  * For `MATCH_DEFAULT`, `__match_args__` acts a map from positions to names.
   * For `MATCH_POSITIONAL`, `__match_args__` acts a map from names to positions.
* Change semantics of `MATCH_DEFAULT` when match class patterns to those of PEP 634.
* Update translations.
* Further expand examples
2021-03-12 18:01:08 +00:00
Mark Shannon 2aec45c8b8
PEP 653: Rephrase translations in terms of failure, rather than success, to make them easier to compose. (#1865) 2021-03-10 15:22:07 +00:00
Mark Shannon c8f7f9cd7c
PEP 653: Make it clearer that MATCH_DEFAULT is the default. (#1823) 2021-02-19 18:55:47 +00:00
Mark Shannon 89183f61d1
Clarify description of __match_kind__. Drop claims of improved security (#1822) 2021-02-19 17:56:52 +00:00
Mark Shannon aeab09a58f
PEP 653: Precise Semantics for Pattern Matching (#1819) 2021-02-18 15:08:53 +00:00