This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author THRlWiTi
Recipients THRlWiTi, eric.smith, mrabarnett, serhiy.storchaka
Date 2017-02-06.08:00:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486368011.75.0.401714465963.issue29459@psf.upfronthosting.co.za>
In-reply-to
Content
__getitem__ was added to match objects as a resolution of issue24454.

Wouldn't it be nice to also have `__contains__` and `get` methods for match objects? Is it even feasible to implement them in neat way?

They should work similar to dictionaries, i.e:

```
match = re.match('(?P<a>a)', 'a')
match.get('b')  # should return None
match.get(1)  # should return 'a'
'a' in match # True
'b' in match # False
```
History
Date User Action Args
2017-02-06 08:00:11THRlWiTisetrecipients: + THRlWiTi, eric.smith, mrabarnett, serhiy.storchaka
2017-02-06 08:00:11THRlWiTisetmessageid: <1486368011.75.0.401714465963.issue29459@psf.upfronthosting.co.za>
2017-02-06 08:00:11THRlWiTilinkissue29459 messages
2017-02-06 08:00:11THRlWiTicreate