diff options
author | Raymond Hettinger <python@rcn.com> | 2017-01-16 22:43:43 -0800 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2017-01-16 22:43:43 -0800 |
commit | e12c313f5e2690d61f99f2fb6a98e7992ff7e12c (patch) | |
tree | 8f700a2759da96dc844c899e0c066eaa2e0ddb6b /Lib/typing.py | |
parent | 741c45adabc23c65ea85ff817c3266665ccf76e1 (diff) | |
parent | 80490525e0e9c08860b0de0c416dbe71c6593af7 (diff) | |
download | cpython-git-e12c313f5e2690d61f99f2fb6a98e7992ff7e12c.tar.gz |
merge
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index 34845b747a..2821c3cb2d 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -59,6 +59,7 @@ __all__ = [ 'SupportsRound', # Concrete collection types. + 'Deque', 'Dict', 'DefaultDict', 'List', @@ -1771,6 +1772,15 @@ class List(list, MutableSequence[T], extra=list): "use list() instead") return _generic_new(list, cls, *args, **kwds) +class Deque(collections.deque, MutableSequence[T], extra=collections.deque): + + __slots__ = () + + def __new__(cls, *args, **kwds): + if _geqv(cls, Deque): + raise TypeError("Type Deque cannot be instantiated; " + "use deque() instead") + return _generic_new(collections.deque, cls, *args, **kwds) class Set(set, MutableSet[T], extra=set): |