News for hackers. Stuff that matters.
Re:WTFPython: Exploring and understanding Python through sur... by zamadatix on Tuesday May 31, 2022 @02:00AM (#31566542)
To me the second version seems not only clearer/more direct to follow but also is a few characters shorter anyways.
Re:WTFPython: Exploring and understanding Python through sur... by japanuspus on Tuesday May 31, 2022 @02:27AM (#31566656)
But the second version needs to run `.strip` twice. It might not make much of a difference for `strip` -- but it still hurts my eyes, and could be an actual performance issue for other operations.
Re:WTFPython: Exploring and understanding Python through sur... by pydry on Tuesday May 31, 2022 @06:56AM (#31568089)
Running strip twice makes it more explicit and readable IMHO - it's then abundantly clear that it's being run as a check and as a way of populating the list.