Skip to content

The extracted method was defined outside of class scope causing 'NameError' #825

Description

@jonh-copin

The extracted method was defined outside of class scope causing 'NameError'

Steps to reproduce the behavior:

  1. Code before refactoring:
class TSV:
    """TSV format. Assumes each row is of the form `text\\tlabel`."""
    delimiter = "\t"

if __name__ == "__main__":
    print(TSV.delimiter)
  1. Apply the extract method to "\t"

  2. Code after refactoring:

class TSV:
    """TSV format. Assumes each row is of the form `text\\tlabel`."""
    delimiter = extracted_method()


def extracted_method():
    return "\t"


if __name__ == "__main__":
    print(TSV.delimiter)

Activity

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