[Tutor] List comprehension possible with condition statements?

Alan Gauld alan.gauld at btinternet.com
Wed Mar 3 19:18:40 CET 2010


"Steven D'Aprano" <steve at pearwood.info> wrote

> Comparisons with None almost always should be one of:
>
> item is None
> item is not None

Yes, but the reason I changed it (I originally had "is not") is that != is
a more general test for illustrating the use of 'if' within a LC which
seemed to be the real issue within the question.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list