Re: deque is not a subclass of Sequence.

2016-04-07 Thread Mark Lawrence via Python-list
On 07/04/2016 10:25, Antoon Pardon wrote: the index() method seems to be added in 3.5, so is deque a subclass of Sequence in 3.5? Yes, this http://bugs.python.org/issue23704 refers. Use the builtin https://docs.python.org/3/library/functions.html#issubclass to try it. >>> issubclass(deque

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Rolf Camps
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 impor

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Peter Otten
Antoon Pardon wrote: > Op 07-04-16 om 11:12 schreef Peter Otten: >> > 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

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Antoon Pardon
Op 07-04-16 om 11:12 schreef Peter Otten: > 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

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Peter Otten
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(li

Re: deque is not a subclass of Sequence.

2016-04-07 Thread Antoon Pardon
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