[Tutor] list comprehension question

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Jun 2 03:18:34 EDT 2004

I'll leave someone else to dop the list comprehension answer but...

> I'd be interested if there is a 'better' or more elegant way.
> the
> if((k==m)or(k==n)or(v==m)or(v==n))

Personally I'd do:

if k in (m,n) or v in (m,n)

Alan G.

More information about the Tutor mailing list