Skip to content

Commit 7c8ae9b

Browse files
committed
Add docs
1 parent 8fe62a9 commit 7c8ae9b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/index.rst

+17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ PPB's 2D Vector class
2424
The Y coordinate of the vector
2525

2626

27+
Pattern Matching
28+
----------------
29+
30+
(Python 3.10 and up only. See pep636_ (PEP 636) for information on pattern
31+
matching in general.)
32+
33+
:py:class:`Vector` supports not only basic pattern matching
34+
(``case Vector(x=4, y=2):``), but also supports positional arguments
35+
(``case Vector(4, 2):``) and also comparison to sequences
36+
(``case (4, 2):``).
37+
38+
However, it does not support matching against dictionaries
39+
(``case {'x': 4, 'y': 2}:``).
40+
41+
.. _pep636: https://www.python.org/dev/peps/pep-0636/
42+
43+
2744
Inheriting from :py:class:`Vector`
2845
-----------------------------------
2946

0 commit comments

Comments
 (0)