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

Add a pure Python version of 'collections.defaultdict' #71407

Closed
Vgr255 mannequin opened this issue Jun 4, 2016 · 5 comments
Closed

Add a pure Python version of 'collections.defaultdict' #71407

Vgr255 mannequin opened this issue Jun 4, 2016 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Vgr255
Copy link
Mannequin

Vgr255 mannequin commented Jun 4, 2016

BPO 27220
Nosy @rhettinger, @Vgr255
Files
  • py_defaultdict_1.patch
  • 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 = 'https://github.com/rhettinger'
    closed_at = <Date 2016-07-07.21:52:50.632>
    created_at = <Date 2016-06-04.17:07:44.346>
    labels = ['type-feature', 'library']
    title = "Add a pure Python version of 'collections.defaultdict'"
    updated_at = <Date 2016-07-07.22:13:05.112>
    user = 'https://github.com/Vgr255'

    bugs.python.org fields:

    activity = <Date 2016-07-07.22:13:05.112>
    actor = 'abarry'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2016-07-07.21:52:50.632>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2016-06-04.17:07:44.346>
    creator = 'abarry'
    dependencies = []
    files = ['43200']
    hgrepos = []
    issue_num = 27220
    keywords = ['patch']
    message_count = 5.0
    messages = ['267276', '269905', '269959', '269960', '269961']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'abarry']
    pr_nums = []
    priority = 'low'
    resolution = 'rejected'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue27220'
    versions = ['Python 3.6']

    @Vgr255
    Copy link
    Mannequin Author

    Vgr255 mannequin commented Jun 4, 2016

    Attached patch adds a pure Python version of collections.defaultdict. This is yet another step in providing better support for alternate implementations, which may or may not have _collections.

    I also went ahead and fixed all so that from collections import * doesn't fail if 'deque' isn't present (which it may not be in alternate implementations).

    Patch includes (small) doc and test changes. All tests pass successfully for both versions.

    @Vgr255 Vgr255 mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 4, 2016
    @Vgr255
    Copy link
    Mannequin Author

    Vgr255 mannequin commented Jul 6, 2016

    Raymond, do you have any interest/time to review this? I can ask someone else, if you prefer.

    @rhettinger
    Copy link
    Contributor

    I don't think there is any advantage to adding a pure python version of defaultdict (or we would have done it a long time ago). Each time we do this, it creates a host of downstream issues where people notice minor implementation differences between the two.

    @Vgr255
    Copy link
    Mannequin Author

    Vgr255 mannequin commented Jul 7, 2016

    I agree that CPython itself gains nothing from having this, as this is so that alternate implementations have it as well. I get what you mean about the minor differences, however I think it's a good thing, as it helps to make sure the tests are precise enough so that there can't be any differences (but that's probably just me).

    @Vgr255
    Copy link
    Mannequin Author

    Vgr255 mannequin commented Jul 7, 2016

    (Also, if this is going to be rejected still, I think that fixing __all__ to only conditionally add 'deque' and 'defaultdict' should be considered)

    @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
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant