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

Open
icecraft opened this issue Jan 10, 2024 · 3 comments · May be fixed by #11276
Open

Global variable should not using in class method #11232

icecraft opened this issue Jan 10, 2024 · 3 comments · May be 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)
@icecraft icecraft added the bug label Jan 10, 2024
@Marco-campione-github Marco-campione-github linked a pull request Feb 10, 2024 that will close this issue
@GantedaAravind
Copy link

GantedaAravind commented Feb 11, 2024

Hi,
i am beginner to open source can you give the instructions to solve this problem.. can i work on this issue

@zakariatahiri
Copy link

hi i am beginner to open source too

@smruthi-sumanth
Copy link

Hello! Can I get the go ahead to start on fixing this issue?

MannCode added a commit to MannCode/Python that referenced this issue Feb 25, 2024
…ce attribute self.N instead of global variable N for better encapsulation and readability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants