Skip to content

Rename Field changes the import and adds a nonexistent name. #831

Open

Description

@jonh-copin

Rename Field changes the import and adds a nonexistent name.

Steps to reproduce the behavior:

  1. Code before refactoring:
-- app.py
from __future__ import print_function

from compat import izip

def pairs(seq1, seq2):
    return list(izip(seq1, seq2))

if __name__ == "__main__":
    print(pairs([1, 2, 3], [4, 5, 6]))

-- compat.py
from __future__ import print_function
import sys

PY2 = (sys.version_info[0] == 2)

if PY2:
    from itertools import imap, izip
else:
    imap = map
    izip = zip

__all__ = ["imap", "izip"]
  1. Apply the rename field to app.py.izip

  2. Code after refactoring:

-- app.py
from __future__ import print_function

from compat import implements_to_string

def pairs(seq1, seq2):
    return list(implements_to_string(seq1, seq2))

if __name__ == "__main__":
    print(pairs([1, 2, 3], [4, 5, 6]))

-- compat.py
from __future__ import print_function
import sys

PY2 = (sys.version_info[0] == 2)

if PY2:
    from itertools import imap, implements_to_string
else:
    imap = map
    implements_to_string = zip

__all__ = ["imap", "implements_to_string"]

Activity

  1. added
    bugUnexpected or incorrect user-visible behavior
    on Nov 24, 2025
  2. added a commit that references this issue on May 6, 2026
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

    bugUnexpected or incorrect user-visible behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions