On Thu, 4 Mar 2010 05:18:40 am Alan Gauld wrote: > "Steven D'Aprano" <st...@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.
List comps can include *any* comparison: [x+1 for x in data if (3*x+2)**2 > 100*x or x < -5] -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor