Deque() should be deque() in Chapter2/generic_search.py
Closed this issue · 1 comments
HayaoSuzuki commented
In Chapter2/generic_search.py class Queue was defined as follows.
class Queue(Generic[T]):
def __init__(self) -> None:
self._container: Deque[T] = Deque()I think that class Quene should be defined as follows.
I use collections.deque instead of typing.Deque.
from collections import deque
class Queue(Generic[T]):
def __init__(self) -> None:
self._container: Deque[T] = deque()davecom commented
Hi Hayao,
Thanks for reaching out. The Deque class from typing.Deque is just a generic analog of the collections.deque class. So, it's really the same thing internally.
class typing.Deque(deque, MutableSequence[T])
A generic version of collections.deque.
https://docs.python.org/3/library/typing.html
Best,
David