deque is not a subclass of Sequence.

Peter Otten __peter__ at web.de
Thu Apr 7 05:41:10 EDT 2016


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 is missing.
>> the index() method seems to be added in 3.5, so is deque
> a subclass of Sequence in 3.5?

Yes, according to the only 3.5 interpreter I have currently available:
python3.5
Python 3.5.0b2+ (3.5:9aee273bf8b7+, Jun 25 2015, 09:25:29) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import deque
>>> from collections.abc import Sequence
>>> isinstance(deque(), Sequence)
True


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /