4 ms·
The "bad" Python code in that example is perfectly fine. I'm not a Python programmer but I can read Python a little bit, and the example uses basic programing c
by twblalock 4y ago
The "bad" Python code in that example is perfectly fine. I'm not a Python programmer but I can read Python a little bit, and the example uses basic programing concepts like string splitting and array ranges.
If you don't understand that, multiple smaller lines won't help you, because you just don't know what you are doing.
In addition, that code example is easily testable. Testability is more important than readability in modern programs that follow modern CI/CD principles -- and the readability is not really that bad either. Also, modern debuggers don't have issues with nested/lambda statements like these.
If the article's author had a legitimate bone to pick, they would have better examples.
- overgard 4y agoThe question isn't if you can figure it out, but how long does it take you? The simple version might take me 2 seconds to read. The original version might take me 10 to 15 seconds. Multiply that out over a day and you're hurting quite a bit.
- macintux 4y ago> In addition, that code example is easily testable. I'm skeptical, because typically a line like that is embedded in the middle of a larger function. Extracting the logic into a dedicated, pure function helps with testing.