[issue14924] re.finditer() oddity

2012-05-27 Thread Francisco Gracia
Francisco Gracia added the comment: Thank you both for your quick and clear explanations. However I regret that I keep considering the situation rather unsatisfactory. I can well understand that all objects are true and even that the convention that applies to some of them, like containers, t

[issue14924] re.finditer() oddity

2012-05-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: > All iterators are always true, More generally, all objects are true by default. The only false objects in Python are None; container-like objects with a __len__ that returns zero; and number-like objects with a __nonzero__ method that returns False. Gu

[issue14924] re.finditer() oddity

2012-05-27 Thread Ezio Melotti
Ezio Melotti added the comment: All iterators are always true, since you can not know how many elements they will give you until you consume them. This is generally known, however it doesn't seem to be well documented. -- assignee: -> ezio.melotti resolution: -> invalid stage: ->

[issue14924] re.finditer() oddity

2012-05-27 Thread Francisco Gracia
New submission from Francisco Gracia : I find baffling the following behaviour of *re.finditer()*: Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import re >>> m = re.findite