The Daily WTF
Today’s story isn’t really a WTF. No, Phil R was mentoring a new developer, and as such, Phil was sending some simple, easily scoped Python tasks over to that developer. After a few really low hanging fruit, Phil gave the Newbie a trickier one. The contact_type field was currently a string. That was a mistake, and it needed to be changed to a number. The change would involve a whole bunch of find-and-replace, but mostly it was just changing strings like ’07’ into 7.
Newbie trotted off, and found this code block:
if contact_type in (’01’, ’05’, ’07’): priority_flag = True
No problem, right? Simple task, just make those integers. Newbie did, and repeated the task in a few places, ran the unit tests, and was happy with the results. But that wasn’t the only change they needed to make before the feature was implemented: one of the codes
To read the full article click on the 'post' link at the top.