[issue9529] Converge re.findall and re.finditer

2010-08-07 Thread Matthew Barnett
Matthew Barnett added the comment: Ah, I see what you mean. I still think you're wrong, though! :-) The 'for' loop is doing is basically this: it = re.finditer(r'(\w+):(\w+)', text) try: while True: match_object = next(it) # body of loop except StopI

[issue9529] Converge re.findall and re.finditer

2010-08-07 Thread MizardX
MizardX added the comment: I don't think (1) would break any code. finditer() would still generate match-objects. The only time you would be discard the match-object, is if you try to do a destructuring bind in, e.g. a loop. This shouldn't be unexpected for the programmer. -- _

[issue9529] Converge re.findall and re.finditer

2010-08-06 Thread Matthew Barnett
Matthew Barnett added the comment: (1) would break existing code. It would also mean that you wouldn't have access to the start and end positions of the matches either. (2) would also break existing code which is expecting a list. It's like the change that happened when some methods which ret

[issue9529] Converge re.findall and re.finditer

2010-08-05 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, moreati, mrabarnett, timehorse stage: -> needs patch type: -> behavior versions: +Python 3.2 ___ Python tracker ___ ___

[issue9529] Converge re.findall and re.finditer

2010-08-05 Thread MizardX
New submission from MizardX : re.findall and re.finditer has very different signature. One iterates over match objects, the other returns a list of tuples. I can think of two ways to make them more similar: 1) Make match objects iterable over their captures. With this, you could write somethi