![](https://secure.gravatar.com/avatar/d24c45635a5171615a7cdb936f36daad.jpg?s=120&d=mm&r=g)
Oct. 21, 2023
12:37 p.m.
Hey, I bet this has been discussed before but I couldn't find it. I'd appreciate it if anyone could point me to that thread. I'm sick of seeing "AttributeError: 'NoneType' object has no attribute 'foo'" whenever there's a `re.match` operation that fails while the code expects it to succeed. What do you think about a flag `require` such that `re.match(pattern, string, require=True)` would either return a match or raise an exception with an actually useful message? Thanks, Ram.