Removing None objects from a sequence

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Dec 13 11:21:22 EST 2008


On Sat, 13 Dec 2008 06:00:09 -0800, bearophileHUGS wrote:

> Steven D'Aprano:
>> The algorithm is unclear: try explaining what you are doing in English,
>> and see how difficult it is.
> 
> That algorithm is a standard one, and quite clear. Any programmer worth
> his/her/hir salt has to be able to understand that.

I didn't say it can't be understood. But please, if you think it is quite 
clear, go ahead and explain how it works, and how you know the algorithm 
is correct and there are no odd corner cases where it fails. As my comp 
sci lecturer used to say, "prove the algorithm is correct".

Remember, Terry made a specific claim: the algorithm is simpler and 
cleaner than Tim's copy-the-values-that-aren't-None solution. It's not 
just clear, it's significantly clearer:

"No, making a filtered copy that is then copied back before being deleted 
is algorithmically much messier.  My code does the minimum work 
necessary and is algorithmically cleaner."

Do you agree with Terry's claim?


-- 
Steven



More information about the Python-list mailing list