Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Most of examples do not test whether findall() returns an empty list. So there 
is no significant difference with using search() -- just different type of 
exception if fails (IndexError, TypeError or AttributeError). Since most 
examples do not handle errors, this will only affect a traceback if you use the 
script improperly.

If it is important to you, you can write (re.search(...) or [])[0] and get the 
same IndexError.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39165>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to