On 4/27/07, Thomas Lotze <[EMAIL PROTECTED]> wrote:
> Guido van Rossum wrote:
> > ``__hash__`` for those instances should raise a ``TypeError``
> > exception.
> Shouldn't this rather be a ValueError since it occurs not because of the
> type of the object in question, but its value (while in general, there are
> instances of the same type representing other values which are hashable)?
Yes, but it is a TypeError today. Is it worth the backwards compatibility?
> > [It] is possible for ``x
> > in o`` to be True even though ``x`` is never yielded by ``iter(o)``.
> To me, 'searchable' isn't associated with subsequences in any way. I'd
> think of a container that is able to answer the question "where is this
> element?" A sequence might return an index or a set of indexes, a mapping
> might return a key or a set of keys in reply to this. If what you're after
> is really a subsequence containment test, it should just live on sequences
> instead of getting an ABC of its own, IMO.
That makes sense. Looking at unordered containers like sets, should
{"a", "b"} in {"b", "a", "d"} be able to return true, by deriving from
Searchable?
If not, then I agree that it is really about sequences.
-jJ
_______________________________________________
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