From 3973f5851a8639338c3a9bd8e638e0ae068bec00 Mon Sep 17 00:00:00 2001 From: 5j9 <5j9@users.noreply.github.com> Date: Fri, 10 Feb 2017 02:53:52 +0330 Subject: [PATCH] Define __getitem__ for Match objects of Python 3.6 (#925) In Python 3.6 __getitem__ was added as a new method for match objects. m[g] is identical to m.group(g). --- stdlib/3/typing.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 9c7ad8c7a..cc775a36d 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -421,6 +421,8 @@ class Match(Generic[AnyStr]): def start(self, group: Union[int, str] = ...) -> int: ... def end(self, group: Union[int, str] = ...) -> int: ... def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ... + if sys.version_info >= (3, 6): + def __getitem__(self, g: Union[int, str]) -> AnyStr: ... class Pattern(Generic[AnyStr]): flags = 0