[Python-3000] PEP 3119 - Introducing Abstract Base Classes

Jim Jewett jimjjewett at gmail.com
Fri Apr 27 21:06:31 CEST 2007

On 4/27/07, Thomas Lotze <thomas at thomas-lotze.de> 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

If not, then I agree that it is really about sequences.


More information about the Python-3000 mailing list