Skip to content

2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange #66490

Closed

Description

@eddygeek
mannequin
BPO 22294
Nosy @benjaminp, @rowillia
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • Files
  • 2to3_more_consuming_calls.diff: patch on current cpython tip (4fc575d55e2b)
  • 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 2021-10-20.22:47:54.010>
    created_at = <Date 2014-08-28.11:43:00.929>
    labels = ['type-feature', 'expert-2to3']
    title = '2to3 consuming_calls:  len, min, max, zip, map, reduce, filter, dict, xrange'
    updated_at = <Date 2021-10-20.22:47:54.009>
    user = 'https://bugs.python.org/eddygeek'

    bugs.python.org fields:

    activity = <Date 2021-10-20.22:47:54.009>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.22:47:54.010>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2014-08-28.11:43:00.929>
    creator = 'eddygeek'
    dependencies = []
    files = ['36495']
    hgrepos = ['271']
    issue_num = 22294
    keywords = ['patch']
    message_count = 1.0
    messages = ['226019']
    nosy_count = 3.0
    nosy_names = ['benjamin.peterson', 'eddygeek', 'Roy Williams']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22294'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    Activity

    1. eddygeek commented on Aug 28, 2014

      eddygeekmannequin
      MannequinAuthor

      This is a patch for issues similar to bpo-16573
      With this patch, the following new tests are now unchanged:

      r = dict(zip(s, range(len(s))), **d)
      r = len(filter(attrgetter('t'), self.a))
      r = min(map(methodcaller('f'), self.a))
      max(map(node.id, self.nodes)) + 1 if self.nodes else 0
      reduce(set.union, map(f, self.a))

      Note that as part of the patch, the range transformation now calls the generic in_special_context in addition to the customized one (which. I guess, should be removed, but I didn't dare).

      All existing tests pass, but the patterns used may not be strict enough, though I tried to stick to how it was done for other consuming calls.

      M Lib/lib2to3/fixer_util.py
      M Lib/lib2to3/fixes/fix_xrange.py
      M Lib/lib2to3/tests/test_fixers.py

    2. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions