Message224489
Yes, but the purpose of this feature is to simplify the use of finditer() in
the "for" loop.
>>> import re
>>> for k, v in re.finditer(r"(\w+):?(\w+)?", "ab:cd\nef\n"):
... print(k, v)
...
ab cd
ef None
Currently you should either unpack manually:
for m in re.finditer(...):
k, v = m.groups()
...
This way doesn't work well with comprehensions.
Or use the operator module:
import operator
for k, v in map(operator.methodcaller('groups'), re.finditer(...)):
...
This way is too verbose and unclear.
Sorry, previous version of the patch had reference leak. |
|
Date |
User |
Action |
Args |
2014-08-01 12:02:14 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, timehorse, ezio.melotti, mrabarnett, moreati, MizardX |
2014-08-01 12:02:14 | serhiy.storchaka | link | issue9529 messages |
2014-08-01 12:02:14 | serhiy.storchaka | create | |
|