On 9/4/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > Georg Brandl schrieb: > > While looking at documenting the dict view changes, I came across an > > inconsistency in how the dict views' set-like operations are implemented: > > with sets/frozensets, the operator versions only work if the other operand > > is a set/frozenset, while the dict view operators allow any iterable. > > > > Do we care?
The Set ABCs in PEP 3119 should be followed IMO. But they haven't received a lot of review so we may have to go back and discuss what that PEP should say (and perhaps it isn't giving enough detail). However, I don't see it as a violation if some of the types are more lenient in what they accept -- they just shouldn't be more restrictive. > Oh, and another thing: the items views can contain unhashable values, so > > d.items() & d.items() > > will fail for such dictionaries since the operands are converted to sets > before doing the intersection. > > I suspect there's nothing that can easily be done about that though... Indeed, since the result must be a new set (not a view) and the result cannot be represented as a set either (unless it's empty or happens to contain no unhashable values, which would be a rare piece of luck). -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
