This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients apalala, ezio.melotti, mrabarnett, rhettinger, serhiy.storchaka, terry.reedy
Date 2020-01-17.13:52:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579269175.82.0.632596010838.issue39165@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-01-17 13:52:55serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, terry.reedy, ezio.melotti, mrabarnett, apalala
2020-01-17 13:52:55serhiy.storchakasetmessageid: <1579269175.82.0.632596010838.issue39165@roundup.psfhosted.org>
2020-01-17 13:52:55serhiy.storchakalinkissue39165 messages
2020-01-17 13:52:55serhiy.storchakacreate