@Stefan : Let us say I use __init__ instead. When I initialize a BaseScalar, since a __new__ method isn't defined, that means the __new__ of superclass (Symbol) will be called.
But, that's what's happening right now as well. Symbol.__new__ is called and it is cached. Therefore, the problem persists. Also, if I use __init__, then since Symbol.__new__ will be called first. But, it throws an error: __new__() takes exactly 2 arguments (4 given) which is why I was using __new__ instead of __init__ in the first place. @Aaron: The symbols are initialized within another class instance. Specifically, it represents field variables in a coordinate system. So, you can initialize any number of rectangular coordinate system objects and each will have a 'x' attribute that will represent the x coordinate variable. Thus the same name. I took the position as strings initially - when the BaseScalars were to be initialized by users - but that has changed now. I can use ints instead. Anyway, here are the things I can do: I can change the superclass to Dummy since using __init__ instead of __new__ doesn't work for the reasons I mentioned. I still do not see how to fix this. You mention adding args to the object but how am I to do that? Symbol.__new__ needs to be called one way or the other - and, it doesn't allow for anything else but name and assumptions. And when it is called, it returns a cached object. So, how am I to add args? One thing I can think of doing is to initialize a different named symbol and change its name later on. How about that? -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
