Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No entry Deque in #73197

rhettinger opened this issue Dec 19, 2016 · 4 comments

No entry Deque in #73197

rhettinger opened this issue Dec 19, 2016 · 4 comments
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement


Copy link

BPO 29011
Nosy @gvanrossum, @rhettinger, @ned-deily, @ilevkivskyi
  • Deque.diff: Patch to add Deque
  • Deque2.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-01-17.06:44:44.908>
    created_at = <Date 2016-12-19.06:19:33.267>
    labels = ['3.7', 'type-feature', 'library']
    title = 'No entry Deque in'
    updated_at = <Date 2017-01-17.06:44:44.907>
    user = '' fields:

    activity = <Date 2017-01-17.06:44:44.907>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-01-17.06:44:44.908>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2016-12-19.06:19:33.267>
    creator = 'rhettinger'
    dependencies = []
    files = ['45979', '46052']
    hgrepos = []
    issue_num = 29011
    keywords = ['patch']
    message_count = 4.0
    messages = ['283590', '283591', '283660', '285616']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'rhettinger', 'ned.deily', 'python-dev', 'levkivskyi']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = ''
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    Copy link
    Contributor Author

    We have:

    # Concrete collection types.
    'NamedTuple',  # Not really a type.

    But no mention of Deque.

    What this an intended omission?

    I would like to be able to write something like this:

       user_posts = defaultdict(deque)  # type: DefaultDict[User, Deque[Post]]

    Copy link
    Contributor Author

    FWIW, I tried "d = deque() # type: typing.MutableSequence" but this gave:

    error: MutableSequence[Post] has no attribute "appendleft"

    @rhettinger rhettinger changed the title No entry for deques in typing No entry Deque in Dec 19, 2016
    Copy link

    I don't recall exactly what happened here, but I think it was left out during formulation of PEP-484 because it's not an ABC. IIRC originally we only wanted to include builtins and ABCs. But we changed that subsequently to include e.g. DefaultDict.

    I suppose we should change this now, but the cat is out of the bag for 3.6.0 and I would prefer not to change in any way between 3.6.0 and 3.5.3, so the best we could do would be to add it to 3.6.1 and 3.5.4 (whenever that will be).

    In the meantime collections.deque is generic, but that's only helpful in type comments, not in annotations.

    In a sense I wish we hadn't put in the stdlib, it would have been much simpler to fix this kind of issue. OTOH there are also advantages to having it in the stdlib, and anyways, it's too late to change, so we'll just have to suck it up (I certainly am).

    @rhettinger rhettinger added stdlib Python modules in the Lib dir 3.7 (EOL) end of life type-feature A feature request or enhancement labels Dec 21, 2016
    Copy link

    python-dev mannequin commented Jan 17, 2017

    New changeset dfefbf6f6c73 by Raymond Hettinger in branch '3.5':
    Issue bpo-29011: Fix an important omission by adding Deque to the typing module.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    None yet

    No branches or pull requests

    2 participants