I see. I guess the ambiguity would stem from trying to force match objects into
the sequence protocol even though the custom __getitem__() means that they're
essentially a mixed mapping:
Mapping[int | str, str | None]
If we avoid any sort of "smart" length derived from only mo.groups() or
See https://bugs.python.org/issue46692. It's not so easy to make match
objects mappings or sequences because of the len() problem.
Eric
On 2/16/2022 9:46 AM, Valentin Berlier wrote:
Hi,
I've been thinking that it would be nice if regex match objects could be
deconstructed with pattern matchi
On Wed, 16 Feb 2022 at 14:47, Valentin Berlier wrote:
>
> Hi,
>
> I've been thinking that it would be nice if regex match objects could be
> deconstructed with pattern matching. For example, a simple .obj parser could
> use it like this:
>
> match re.match(r"(v|f) (\d+) (\d+) (\d+)", line):