I'm writing a program that randomly assembles mathematical expressions using the values stored in this class. The operators are stored in a dictionary along with the number of arguements they need. The arguements are stored in a list. (the four x's ensure that the x variable gets chosen often) depth, ratio, method and riddle are other values needed.
I put these in a class so they'd be in one place, where I can go to change them. Is this the best pythonic way to do this? It seems that I can't refer to them by Params.depth. This produces the error 'Params has no attribute 'depth'. I have to create an instance of Params() (p = Params()) and refer to them by p.depth.
I'm faily new to Python. Thanks
class Params(object):
def __init__(self):
object.__init__(self)
self.atoms =['1.0','2.0','3.0','4.0','5.0','6.0','7.0','8.0','9.0','x','x','x','x']
self.operators = {'+': 2, '-': 2, '*': 2, '/': 2,'+': 2, '-': 2, '*': 2, '/': 2, '**': 2, '%': 2}
self.depth = 1
self.ratio = .4
self.method = ''
self.riddle = '1 + np.sin(x)'