3 ms·
his code looks like a hack job by a poor programmer Well, it does. Specifying case insensitive match and then handling both cases yourself reeks of someone who
by gaius 17y ago
his code looks like a hack job by a poor programmer
Well, it does. Specifying case insensitive match and then handling both cases yourself reeks of someone who's never parsed anything before. The second case won't even do anything, it's already been done! And even if the language or the libraries worked that way, what about mixed case! Let alone parsing HTML with regexps in the first place. Python has BeautifulSoup for not-well-formed documents.
It's reasonable from that code snippet to infer the author understands neither the language he's using nor the problem domain he's working in.
- tjr 17y agoIt's reasonable from that code snippet to infer the author understands neither the language he's using nor the problem domain he's working in. Well, does the program actually work as intended? If so, that's a pretty good indication that the author does understand the language and the problem domain, even if the code isn't pristine.
- _csoo 17y agohe obviously hates dealing with regular expressions and I do too. It's only natural.
- gaius 17y agoSo he used double the number of regexps he needed?
- RussNelson 17y agoErrr, no, it's not. There are other reasonable inferences: that the programmer isn't concerned about efficiency of the running code but instead with his efficiency in coding; that the programmer originally had the code doing one thing, but changed it to do another and hasn't (yet) noticed that it's now redundant; that it's not wrong code, but instead redundant code so qwitcherbellyaching and submit a patch. I parse HTML with regexps when I know it's been machine-generated with a certain structure and I'm only interested in pulling out the bits using re.search(r'blah(%s)blah') that got put in there with a printf "blah$(x)blah". You're going to be tarring a lot of not-incorrect code with that brush of yours.