In the code below, I access the global variable n inside a method in a class. If I intend on only reading the variable, is this considered bad practice? The alternative being passing the variable to a constructor or as an argument to number?
n = 2
class yes:
def number(self):
return n
y = yes()
print(y.number())