3 ms·
Yeah, of course you can flatten a list. It seems like Python programmers enjoy writing the same code over and over again. Would it really be bad if I could jus
by mruts 7y ago
Yeah, of course you can flatten a list. It seems like Python programmers enjoy writing the same code over and over again.
Would it really be bad if I could just do lst.flatten ? Or flatten(lst)?
- o_nate 7y agoThere's a case to be made that flattening a list is not a common enough operation to justify a built-in keyword or even a method on the standard library list class. The Pythonic way seems to be that if you can write something with a simple and clear one-liner then it's better and clearer to have people use that one-liner than another built-in method that people would have to go look up the implementation of.
- mruts 7y agoI mean, you don’t believe that, do you? Maybe we should all be writing our own sorting algorithms as well. I kind of assumed that DRY was a universally accepted principle in software engineering. But I guess the Pythonic way is about copy and pasted code, no abstractions, wasting people’s time, egregious language inconsistencies, no multi-threading, and terrible performance. I’ve probably written more Python than any other language, and honestly, using it feels bad. It feels outdated and useless.
- marmaduke 7y agoI think you're feeding a troll here. Anyone with time enough in engineering or programming can recognize and respect these sorts of tradeoffs without trash talking least favorite tool.