[New-bugs-announce] [issue42601] [doc] add more examples and additional explanation to re.sub

Harvastum report at bugs.python.org
Tue Dec 8 08:48:29 EST 2020


New submission from Harvastum <harvastum at gmail.com>:

This entire page:
https://docs.python.org/3.10/library/re.html
does not have a single occurrence of the word "lambda".
In my humble opinion it's a pretty important trick to utilize capture groups in lambdas to e.g. use them to access value in a dictionary.
Examples are available here: https://stackoverflow.com/a/18737927/6380791
and here:
https://www.oreilly.com/library/view/python-cookbook/0596001673/ch03s15.html
but somehow not in the documentation.
There is a mention about referencing groups from different contexts, but the lambda is quite unique and although I think it does fall under "when processing match object m", I think it still is worth its own entry.

Btw. it's my first contribution here, sorry for any faux pas I may have commited, please point it out if I did!

----------
assignee: docs at python
components: Documentation
messages: 382736
nosy: docs at python, harvastum
priority: normal
severity: normal
status: open
title: [doc] add more examples and additional explanation to re.sub
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42601>
_______________________________________


More information about the New-bugs-announce mailing list