Skip to content

2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange #60777

Closed

Description

@jpkotta
mannequin
BPO 16573
Nosy @benjaminp
Files
  • enumerate.patch: 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 = None
    closed_at = <Date 2012-11-29.15:58:59.066>
    created_at = <Date 2012-11-28.23:58:00.196>
    labels = ['type-bug', 'expert-2to3']
    title = '2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange'
    updated_at = <Date 2012-11-29.15:58:59.064>
    user = 'https://bugs.python.org/jpkotta'

    bugs.python.org fields:

    activity = <Date 2012-11-29.15:58:59.064>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-11-29.15:58:59.066>
    closer = 'python-dev'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2012-11-28.23:58:00.196>
    creator = 'jpkotta'
    dependencies = []
    files = ['28152']
    hgrepos = []
    issue_num = 16573
    keywords = ['patch']
    message_count = 3.0
    messages = ['176590', '176656', '176657']
    nosy_count = 3.0
    nosy_names = ['benjamin.peterson', 'python-dev', 'jpkotta']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16573'
    versions = []

    Activity

    1. jpkotta commented on Nov 28, 2012

      jpkottamannequin
      MannequinAuthor

      enumerate() is a "consuming_call", as defined in fixer_util.py, because it takes an iterable (not necessarily a collection). Therefore whenever we have something like enumerate(zip(...)), we don't need to replace it with enumerate(list(zip(...))) in 2to3, because enumerate doesn't care that zip no longer returns a list.

      Patch attached.

    2. benjaminp commented on Nov 29, 2012

      @benjaminp
      Contributor

      Thanks for the patch.

    3. python-dev commented on Nov 29, 2012

      python-devmannequin
      Mannequin

      New changeset 3c6d8461b09f by Benjamin Peterson in branch '3.2':
      enumerate only requires an iterable (closes bpo-16573)
      http://hg.python.org/cpython/rev/3c6d8461b09f

      New changeset 4ff17cf130eb by Benjamin Peterson in branch '3.3':
      merge 3.2 (bpo-16573)
      http://hg.python.org/cpython/rev/4ff17cf130eb

      New changeset 2bb604a691de by Benjamin Peterson in branch '2.7':
      enumerate only requires an iterable (closes bpo-16573)
      http://hg.python.org/cpython/rev/2bb604a691de

      New changeset ce3f0399ea33 by Benjamin Peterson in branch 'default':
      merge 3.3 (bpo-16573)
      http://hg.python.org/cpython/rev/ce3f0399ea33

    4. 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

      topic-2to3type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions