Skip to content

Global variable should not using in class method #11232

Closed
@icecraft

Description

@icecraft

Repository commit

9caf478

Python version (python --version)

python3.11

Dependencies version (pip freeze)

#nop

Expected behavior

Hi, guys. I come across one global variable that used in class method. I think using instance attribute would be better !

    def show_data(self):
        show_list = []
        for i in range(1, N + 1):  ==> should using self.N instead of N !
            show_list += [self.query(i, i)]
        print(show_list)

source

Actual behavior

    def show_data(self):
        show_list = []
        for i in range(1, self.N + 1):  
            show_list += [self.query(i, i)]
        print(show_list)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions