Logic operators with "in" statement

Richard Brodie R.Brodie at rl.ac.uk
Mon Nov 16 15:17:20 CET 2009


"Mr.SpOOn" <mr.spoon21 at gmail.com> wrote in message 
news:mailman.492.1258380560.2873.python-list at python.org...

> In [13]: ('b3' and '5') in l or ('3' and 'b3') in l
> Out[13]: True

For anything more than the simplest cases, you might want use sets.

That might be the correct data type from the start, depending on
whether the ordering is important anywhere. 





More information about the Python-list mailing list