"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > Nobody says you shouldn't use list(s) if you know you're dealing with > > a set. The idea of s.values() is so you can duck-type between dicts > > and sets. > > if y is a dict, "x in y" looks for a matching key, not for a > matching value.
Good point, the duck typing mismatches on "x in y" and there's nothing that can be done about that. Imagine a Bag (multiset) object; it can have multiple occurrences of a single value. A keys() operation on it should return unique items, but values() should return the multiple occurrences. -- http://mail.python.org/mailman/listinfo/python-list