Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variable should not using in class method #11232

Closed
icecraft opened this issue Jan 10, 2024 · 3 comments · Fixed by #11276
Closed

Global variable should not using in class method #11232

icecraft opened this issue Jan 10, 2024 · 3 comments · Fixed by #11276
Labels

Comments

@icecraft
Copy link

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)
@GantedaAravind

This comment was marked as off-topic.

@zakariatahiri

This comment was marked as off-topic.

@smruthi-sumanth

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment