John Nagle <na...@animats.com> writes:
>    d1 = set('monday','tuesday')
>    days_off = set('saturday','sunday')
>    if not d1.isdisjoint(days_off) :...
>    This is cheaper than intersection, since it doesn't have to
> allocate and construct a set. It just tests whether any element in the
> smaller of the two sets is in the larger one.

I wonder what the complexity is, since the simplest implementation using
the dict-like features of sets is quadratic.  There is of course an
obvious n log n implementation involving sorting.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to