For a number of built-in types (specified below), a single positional
subpattern is accepted which will match the entire subject; for these types
- no keyword patterns are accepted.
+ keyword patterns also work as for other types.
If only keyword patterns are present, they are processed as follows,
one by one:
* If this raises an exception, the exception bubbles up.
- * If the returned value is not a list or tuple, the conversion fails and
+ * If the returned value is not a tuple, the conversion fails and
:exc:`TypeError` is raised.
* If there are more positional patterns than ``len(cls.__match_args__)``,
.. data:: object.__match_args__
- This class variable can be assigned a tuple or list of strings. When this class is
+ This class variable can be assigned a tuple of strings. When this class is
used in a class pattern with positional arguments, each positional argument will
be converted into a keyword argument, using the corresponding value in
*__match_args__* as the keyword. The absence of this attribute is equivalent to