On 2016-04-07 11:12, Peter Otten wrote:
Antoon Pardon wrote:
Second tryal, I hope the formatting doesn't get messed up now
Playing around with the collections and collections.abc modules in
python3.4 I stumbled upon the following:
from collections.abc import Sequence
from collections import deque
isinstance(list(), Sequence)
True
isinstance(deque(), Sequence)
False
This seems strange to me. As far as I understand, the
documentation indicates there is no reason why deque
shouldn't be a subclass of Sequence.
Am I missing something or can this be considered a bug?
from collections import deque
from collections.abc import Sequence
[name for name in set(dir(Sequence)) - set(dir(deque)) if not
name.startswith("_")]
['index']
So the index() method seems to be what is missing.
The index method was added to the deque object in Python 3.5.
Python 3.5.1 (default, ...)
[GCC ...] on linux
>>> import collections
>>> isinstance(collections.deque(), collections.abc.Sequence)
True
--
https://mail.python.org/mailman/listinfo/python-list