python-rope / rope

a python refactoring library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rename Field refactoring allows the use of a name that can not be iterable

researcher175 opened this issue · comments

Rename field refactoring allows the use of post-declared methods as new names for the field.
It would be nice if Rope could emit an alert to the users indicating the probable problems that could be generated if the operation continues.
Python's name resolution can cause type errors during execution.

Steps to reproduce the behavior:

  1. Code before refactoring:
MIN_CORPORA = ['brown']
ADDITIONAL_CORPORA = ['movie_reviews']
ALL_CORPORA = MIN_CORPORA + ADDITIONAL_CORPORA

def download(param):
    pass

def download_lite():
    for each in MIN_CORPORA:
        download(each)

def download_all():
    for each in ALL_CORPORA:
        download(each)


def main():
    download_lite()
    download_all()


main()
  1. Apply the Rename Field refactoring with the new name 'download_all' to the field 'MIN_CORPORA'

Closing. Ticket merged into #779.