class Matrix:
decimals = True
def __init__(self, decimals=decimals):
if decimals:
print('The matrix will have decimal values.')
else:
print('The matrix will have float values.')
Matrix.decimals = False
mat1 = Matrix()
Output:
The matrix will have decimal values.
I'm trying to make it to where I can change the value of decimals
for all instances of a class while also using it as an argument in the __init__
method. Why is the above not working?